cp -R /source/*.ogg /target/
does not work, I figure that this may be because some
directories only contain subdirectories
I have experimented with looping like this:
for arg in $(ls -R /source/ | grep .ogg);
do
echo $arg;
done
but this only lists the files and not their paths
Thanks for your help
Chris Roy-Smith
--
"Corrupt politicians make the other ten percent look bad."
__Henry A. Kissinger
> On 2008-12-21, Chris Roy-Smith <chris_r...@internode.on.net> wrote:
>>
>>
>> Hi,
>> caution, bash beginner here.
>> I am trying to figure out how to make a new copy
>> all subdirectories and copy only the contents that
>> match the expression *.ogg.
>>
>> cp -R /source/*.ogg /target/
>>
>> does not work, I figure that this may be because some
>> directories only contain subdirectories
>>
> It doesn't work because the shell expands wildcards, so the cp command
> only gets the names of .ogg files in /source. You could do something
> with find /source -name '*.ogg'
Exactly correct.
It should be more obvious to the OP what is going on if he types,
ls /source/*.ogg
--
sig goes here...
Peter D.
try this:
find /source -name "*.ogg" -print0 | xargs -0 tar cf - | tar -C /target -xvf
>> It doesn't work because the shell expands wildcards, so the cp command
>> only gets the names of .ogg files in /source. You could do something
>> with find /source -name '*.ogg'
>
> Exactly correct.
>
> It should be more obvious to the OP what is going on if he types,
> ls /source/*.ogg
I always tell then to use "echo"
echo /source/*.ogg