chore: reformatted and optimized imports. Co-authored-by: Jan Tumpa <jtumpa@gmail.com>
21 lines
422 B
Python
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
|