This script checks local files and only gets new files from FTP server.
put secret.yaml file to root dir:
FTP_HOST: 'xxx.xxx.xxx.xxx'
FTP_PORT: 22
FTP_USER: 'ftp_user'
FTP_PASSWD: 'ftp_pass'
FTP_FOLDER: 'ftp_folder' # or leave blank to use root dir
LOCAL_FOLDER: 'local_folder' # or leave blank to use root dir
LOCAL_UTC: 3 # int - hour delta to UTC time
Create OnlyNewFTPFilesGetter class object. And run update_local_files() method
ftp = OnlyNewFTPFilesGetter()
ftp.update_local_files()
p.s. (be aware)
script gets modification time in FTP folder.
# script gets creation time in local folder.
script gets modification time in local folder.
- Add logger
- Add filter to _get_ftp_file_names_dates. To filter out directiories in output
- Add last year files logic. Right now FTP don't give information about year of file creation. So it could cause problems, when january comes.
- [resolved] Add "TimeoutError: [WinError 10060]" handler, to avoid server termination if no connection