I want to copy a single file if (and only if) the destination does not exist. The source file changes rarely, maybe once a month. The destination almost never exists.Are there any differences between the -n and -u options? (Or both!)cp is being called directly from crond. No othercp options are used.The same cron job is called on several machines at the same time, reading from the same source and writing to the same destination (both on a shared GFS global file system). The destination file will be moved shortly thereafter by another process, so the only time it could exist is during the race when the cron job executes simultaneously on several nodes.Which would be more efficient? :cp -n source destcp -u source destcp -nu source destcp -pu source destI'm currently leaning towards the simple -n alternative.
cp options --no-clobber vs. --update
cp;gnu;coreutils
It's meaningless to combine -n and -u.Use -n if you never want to overwrite an existing file.Use -u if you don't want to overwrite newer files.The case where the two differ, then, is where you have a destination file that's older than the source file.  Consider what you want to happen for this case, and write your command accordingly.I'd expect that -n is more efficient than -u - but the effect is unlikely to be at all measurable.(In the above, 'older', 'newer' etc. are all in terms of the mtime of the files.