09 May 2011, 14:09

Copying files a different way...

I’ve just been sorting through my digital music collection and found a bunch of mp3 files mixed together with other formats. As my car stereo only plays mp3 files, I wanted to copy all the mp3 files and maintain the directory heirarchy (album/artist/song). The following allows me to achieve this:

cd /inputdir; find . -name '*.mp3' -print0 | xargs -0 tar -cvf - | (cd /outputdir; tar -xvf - )