Eric Blake wrote: > Why not use "rsync --ignore-existing" instead?
Agreed that rsync is definitely the right tool for this task. Most of the time when people are trying to avoid overwriting existing files it is because they are trying to avoid spending the computer time to do the copy again and not trying to avoid changing the file again. A large directory of large files, say a photo gallery, can take a long time to complete a full copy for example. In which case I would not use the rsync --ignore-existing option even though it does exactly answer the question. That would not sync the file if the file were different. Instead I would simply let rsync determine that the file has been copied correctly previously and skip copying it a second time. This is the sweet spot for rsync. To have rsync do this optimization the timestamp must be copied. That means that -t option must be present otherwise rsync acts similarly to cp and the file will have a current timestamp. I prefer -a because it does the right thing and is equivalent to the -rlptgoD options. rsync -a source/ destination/ I prefer to use source to destdir/ rsync -a /path/to/src/somedir /path/to/dst/ That would result in /path/to/dst/somedir when the rsync is finished. Bob _______________________________________________ Bug-coreutils mailing list [email protected] http://lists.gnu.org/mailman/listinfo/bug-coreutils
