diff --git a/src/backend/delete_temp_contents.py b/src/backend/delete_temp_contents.py index 5eabca7..583de9c 100644 --- a/src/backend/delete_temp_contents.py +++ b/src/backend/delete_temp_contents.py @@ -1,13 +1,22 @@ import os from omegaconf import OmegaConf +from pathlib import Path config = OmegaConf.load("config.yaml") def delete_temp_contents(): """ delete_temp_contents deletes the contents of the temp directory. """ - for root, dirs, files in os.walk(config.database.tempdir): + path = config.database.tempdir + path = path.replace("~", str(Path.home())) + path = Path(path) + path = path.resolve() + for root, dirs, files in os.walk(path): for file in files: os.remove(os.path.join(root, file)) for dir in dirs: - os.rmdir(os.path.join(root, dir)) \ No newline at end of file + os.rmdir(os.path.join(root, dir)) + + +if __name__ == "__main__": + delete_temp_contents() \ No newline at end of file