Wednesday, October 10, 2007

copy files with extension

I was looking for a command to copy all of the files with a given extension from one directory to another.  I know I could pipe the output of find to xargs where cp would be run, but you have to take special care to escape the paths. 


Here is a way to do the same thing with rsync:

rsync -azvE -r -m --include "*/" --include "*.mp3" --exclude "*" --verbose --progress /source/path/ /destination/path/