Is there a way to have
--update option print files that did not copy because the source directory contained a newer version of the file?
migrated from stackoverflow.com Apr 16 '12 at 14:49
This question came from our site for professional and enthusiast programmers.
It's not a typo there are two
The skipped files will look like
Or if you will be using it interactively the
I don't think there is a way to have
This little one-liner comes with some limitations:
1) It depends on there not being any files named "NOFILES". You can change that string in the
2) You must be in the directory where
3) It won't work if you for some reason have backticks or single quotes in your filenames.
As you can tell this isn't the most robust solution, but it should do for a one-off operation.
I woke up this morning and realized that the above solution was garbage. If you tried to copy multiple files it would search as many times as you have files, excluding one file each time. The following solution, however, should work:
It builds up a regex as it goes and passes that to
Sorry about the brain-fart earlier. Guess it was too late to be on StackOverflow.
Would rsync do the job for you? It has many options that fit your description, say "don't overwrite newer files" and such. And you can have it log findings. I use it often for remote AND local file copying.
You can get very granular with it too.