tar with pipe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



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.

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux