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): os.remove(pathfile) print('removed demo: ', pathfile)