On Sun, 25 Sep 2005 at 5:56pm, Kai wrote > CentOS 4.1 X86_64 > > I am trying to collect all my music files and extract them into a new > directory flat, (without the hierarchy) > > The command works find without the pipe, but do not work with. > > 1.Why don't the command work after the pipe? > 2.How do I remove the hierarchy before extracting? > > $ 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 \{} . -- Joshua Baker-LePain Department of Biomedical Engineering Duke University