further changes to avoid directory bug

This commit is contained in:
Christian 2021-02-02 22:53:02 +01:00
parent b6d74c9e5b
commit 6b203dc298
4 changed files with 7 additions and 4 deletions

View File

@ -8,6 +8,4 @@
##config file: server specifics
##python3 demo_mover.py config.json
##should be run with a .service triggered through a systemctl timer

View File

@ -21,6 +21,8 @@ def create_remote(config, settings):
def distribute_files(path_list, dest):
for pathfile in path_list:
if not str(pathfile).endswith('.dem'):
continue
log_msg = "uploading demo: " + str(pathfile)
logging.info(log_msg)
if not dest.put(pathfile, dest.path):

View File

@ -13,5 +13,6 @@ class local_dir_remote:
def delete_local(self, pathfile):
with contextlib.suppress(FileNotFoundError):
if str(pathfile).endswith('.dem'):
os.remove(pathfile)
print('removed demo: ', pathfile)

View File

@ -109,6 +109,8 @@ class sftp_remote:
self.connect()
for pathfile in source_files:
pathfile = str(pathfile)
if not pathfile.endswith('.dem'):
continue
filename = pathfile.split("/")[-1]
pathfile = self.path + filename
utime = self.sftp.stat(pathfile).st_mtime