# Automatically abort script on errors
option batch abort
# Disable overwrite confirmations that conflict with the previous
option confirm off
# Echo commands as they are executed
option echo on


# Connect to SFTP server using a password
open scp://root:Passw0rd@10.30.65.238/ -hostkey="ssh-rsa 2048 ac:c0:12:49:75:13:48:8b:4e:1a:e9:0d:dc:e7:9a:f8"


# Synchronize command defaults to current local and remote directories
lcd F:\VMServerBackup\%1%
cd /vmfs/volumes/datastore1/%1%

# List local directory
lls

# List remote directory
ls

# 'local' = Syncronizes changes in remote dir to the local dir
# -preview: show changes but do not executed
# -delete: delete obsolete files
# -mirror: syncs even older files
# -preservetime default is to preserve local timestamps, but this means it will continue to see mismatch
synchronize remote -delete -transfer=binary


# List local directory
lls

# List remote directory
ls

# Sync again - it SHOULD NOT find any changes, but it WILL and will transfer all files AGAIN
synchronize remote -delete -transfer=binary


# Sync in reverse direction says "nothing to sync" but also claims the remote files are 
# modified relative to local (more recent)
synchronize local -delete -transfer=binary


# Disconnect 
close
exit
