copy - Copying files with filtering out same files
2014-07
I'm having this problem. I copied bunch of files from one disk to another (around 200gb). Some files in the process didn't copy, mostly because the name was to long.
So, I'm looking for a tool that can find, correct (or let me correct), and copy remaining files. Is there any out of the box tools out there?
I had a very similar problem. On windows I used this to batch rename and copy files.
The tool is called Bulk Rename Utility. It basically lets you use Regex to match multiple files and rename them according to a pattern. It also allows for file name trimming which sounds like exactly what you need. There are also other similar tools out there that will allow you do to same and a quick Google search will reveal most of them.
How can I copy all files with a certain extension from one location to another?
For example, I want to copy all my music files onto my mp3 player, but my music folder on my hard drive contains cover art as well as music. I am aware that I could just copy everything across and then delete all the images, but I am hoping for a better solution than that. I have seen a solution using rsync, like
rsync -av --exclude "*/" --include "*.mp3" --include "*.ogg" --include "*.wma" --include "*.flac" ~/Music/. /media/E100/Music
but this complains lots about not being able to change the group of the files, and for some reason didn't copy all the files over (it left some directories blank). Also, I would prefer that the creation date on the files is the current time, since this would probably work better with the mp3 player's internal database.
Other things that I would really like: It would be nice if it doesn't overwrite the files, but only copies the latest files over, however, if I have to erase all the files and then copy the whole directory across, I can handle that as well.
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