24 lines
545 B
Python
24 lines
545 B
Python
import os
|
|
from pathlib import Path
|
|
from src import database
|
|
|
|
|
|
|
|
def delete_temp_contents():
|
|
"""
|
|
delete_temp_contents deletes the contents of the temp directory.
|
|
"""
|
|
path = 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))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
delete_temp_contents()
|