diff --git a/demo_mover/README.md b/demo_mover/README.md index 4c07ae07..738dcd81 100644 --- a/demo_mover/README.md +++ b/demo_mover/README.md @@ -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 diff --git a/demo_mover/demo_mover.py b/demo_mover/demo_mover.py index 9e43d22f..48c44349 100644 --- a/demo_mover/demo_mover.py +++ b/demo_mover/demo_mover.py @@ -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): diff --git a/demo_mover/remote_local_dir.py b/demo_mover/remote_local_dir.py index c674125d..91b532e1 100644 --- a/demo_mover/remote_local_dir.py +++ b/demo_mover/remote_local_dir.py @@ -13,5 +13,6 @@ class local_dir_remote: def delete_local(self, pathfile): with contextlib.suppress(FileNotFoundError): - os.remove(pathfile) - print('removed demo: ', pathfile) + if str(pathfile).endswith('.dem'): + os.remove(pathfile) + print('removed demo: ', pathfile) diff --git a/demo_mover/remote_sftp.py b/demo_mover/remote_sftp.py index cc59401c..9b475322 100644 --- a/demo_mover/remote_sftp.py +++ b/demo_mover/remote_sftp.py @@ -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