projects-jenz/demo_mover/remote_local_dir.py

18 lines
436 B
Python
Raw Normal View History

2021-02-02 22:29:17 +01:00
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)