Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
elebumm
GitHub Repository: elebumm/RedditVideoMakerBot
Path: blob/master/utils/cleanup.py
327 views
1
import os
2
import shutil
3
from os.path import exists
4
5
6
def _listdir(d): # listdir with full path
7
return [os.path.join(d, f) for f in os.listdir(d)]
8
9
10
def cleanup(reddit_id) -> int:
11
"""Deletes all temporary assets in assets/temp
12
13
Returns:
14
int: How many files were deleted
15
"""
16
directory = f"../assets/temp/{reddit_id}/"
17
if exists(directory):
18
shutil.rmtree(directory)
19
20
return 1
21
22