Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

tiwas

Re: Script continually downloads directories - need help

martin wrote:



Thanks. There are a couple of good solutions I'll have to look at. Both remembering the last timestamp and the files would be good solutions, although the timestamp one is probably the better one in the long run.

Cheers!
tiwas

Script continually downloads directories - need help

Hi,
I've set up a script to synchronize a remote directory via SFTP. Things seemed fine until I added a directory to the mix. If I delete the local directory, the script will re-download it - which is not the intended behavior.

I would appreciate it if someone could have a look and suggest what needs to be changed.

Intended behavior: Copy everything from the remote directory into the local. If the local is deleted, it should not be re-downloaded. If the remote is deleted I really don't care if the local is deleted or not.

option batch abort
option confirm off
open sftp://user:password@host:port -hostkey="ssh-ed25519 255 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"
synchronize local \\ip\share\dir1\dir2 /path/to/remote/files
exit


Thanks!