I wrote it in Perl, but you could do something similar in Bash or indeed any language. This script does do or at least attempt two scp's, but that isn't as inefficient as it sounds: if the first scp succeeds, it won't do the second, so really there's only a very little extra overhead.
By showing existing files at the end, I'm not going to miss seeing them. You could also write errors to a file so that you could easily examine the problems. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. I don't want that to happen again. No Clobber in SSH I thought there surely must be a "no clobber" or "no over-write" or "no update" option in ssh.
Apparently the developers see no need of such a thing and will always suggest using rsync instead because rsync has a flag for that: --ignore-existing skip updating files that exist on receiver That DOES work, but it's not helpful for my need.
WON'T over-write The problem with that is that it ignores silently. WON'T over-write But that's too noisy for my tastes: existing. Got something to add? Send me email. You may want to set a specific directory just for this purpose. Printer Friendly Version. We are standing on a whale fishing for minnows. Joseph Campbell. Troubleshooting posts. You want to avoid this. In another similar situation, you may want to upload local files to a remote site, but without replacing any remote files.
In this case, you need to explicitly tell rsync to skip any existing files during sync. Otherwise, rsync will try to use file modification time to sync two hosts, which is not what you want.
Another way to scp only new files over to a destination is by leveraging file permissions. More specifically, what you can do is to make all destination files "read-only" before scp transfer.
This will prevent any existing destination files from being overwritten by scp. After scp transfer is completed, restore the file permissions to the original state. The ACL command-line tools getfacl and setfacl come in handy when you temporarily change file permissions and restore them.
Similarly, to upload all local files without replacing any remote file, first back up the file permissions of the remote destination folder.
0コメント