create and delete files

This commit is contained in:
WorldTeacher
2024-02-07 11:37:31 +01:00
parent 244bd0bb25
commit 11fdae1553
2 changed files with 46 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
import os
from omegaconf import OmegaConf
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):
for file in files:
os.remove(os.path.join(root, file))
for dir in dirs:
os.rmdir(os.path.join(root, dir))