Home » Questions » Computers [ Ask a new question ]

File copy with filter

File copy with filter

How can I copy all files with a certain extension from one location to another?

Asked by: Guest | Views: 201
Total answers/comments: 1
Guest [Entry]

"It sounds like you've already got the solution you want with rsync.

If it's complaining about permissions and unable to copy certain things, try running it with sudo

sudo rsync -auv etc etc

EDIT: The -a flag is what is causing it to preserve times. The -a flag is an alias for -rlptgoD and the -t flag is what causes the times to be preserved. You may prefer to use rsync like this:

sudo rsync -rlpgoDuv etc etc

also: for particularly long copies, you may want to use the --progress flag rather than -v.

Seems this works:

sudo rsync -rlpuv --progress --include ""*/"" --include ""*.mp3"" --include ""*.ogg"" --include ""*.wma"" --include ""*.flac"" --exclude ""*"" ~/Music/ /media/E100/Music"