projects-jenz/demo_mover/remote_local_dir.py
2021-02-02 22:53:02 +01:00

19 lines
491 B
Python

from pathlib import Path
import contextlib
import os
class local_dir_remote:
def __init__(self, config):
self.config = config
self.path = config["path"]
def list_dir(self):
path = Path(self.path)
return list(path.glob('*'))
def delete_local(self, pathfile):
with contextlib.suppress(FileNotFoundError):
if str(pathfile).endswith('.dem'):
os.remove(pathfile)
print('removed demo: ', pathfile)