Files
RedditVideoMakerBot/utils/cleanup.py
T
JasonandJan Tumpa ed97ae4ebb fix: fixed the GUI
chore: reformatted and optimized imports.

Co-authored-by: Jan Tumpa <jtumpa@gmail.com>
2023-09-03 17:22:55 -04:00

21 lines
422 B
Python

import os
import shutil
from os.path import exists
def _listdir(d): # listdir with full path
return [os.path.join(d, f) for f in os.listdir(d)]
def cleanup(reddit_id) -> int:
"""Deletes all temporary assets in assets/temp
Returns:
int: How many files were deleted
"""
directory = f"../assets/temp/{reddit_id}/"
if exists(directory):
shutil.rmtree(directory)
return 1