I would like to download files from an SFTP Server using the package pysftp. The script should also check if the file already exists in the local path. If yes, this file should be ignored and not overwritten. The following code downloads the file but overwrites the existing files each time:
import pysftp
cnopts = pysftp.CnOpts()
cnopts.hostkeys = None
sftp = pysftp.Connection('XXX.XXX.XXX.XXX', username='user', password='pwd', cnopts=cnopts)
sftp.get_d(remotedir='/upload/dir', localdir='data/dir')
Can somebody help?
THX Lazloo