[CentOS] tar with pipe

Sun Sep 25 16:52:49 UTC 2005
Kai <centos.newsgroup at sandsengen.com>

Joshua Baker-LePain wrote:
> On Sun, 25 Sep 2005 at 5:56pm, Kai wrote
>> $ tar -cvf music.tar `find ../ -name '*.mp3' -o -name '*.ogg'` | tar 
>> -xvf music.tar
> 
> 
> Pipes direct the next command to read from stdin, but the '-f' flag to 
> 'tar c' send its output to the named file, not stdout.  A better form of 
> the above command would be:
> 
> tar cvO `find ../ -name '*.mp3' -o -name '*.ogg'` | tar xf -
> 
> The 'O' in the first tar sends its output to stdout, and the 'f -' in 
> the 2nd tells tar to read from stdin.
> 
> *However*, that will keep the directory structure.  Why not just use cp?
> 
> find ../ -name '*.mp3' -o -name '*.ogg' -print0 | xargs -0 -i cp \{} .
> 
Thank you for explaining, cp would be find, but I don't understand your 
arguments after the pipe.
Please explain..

I have tried to use find ....... -exec cp {}\; but cant get anything 
working using the cp in this type of command.