hey I'm wondering how I can delete certain directory content using python script in pythonanywhere. I used to do it on my system with the following code:
def clean_folder(msg_id=None):
files = glob.glob('/home/pedich/media/*')
if msg_id == None:
for f in files:
os.remove(f)
else:
for f in files:
if str(msg_id) in f:
os.remove(f)
return None
but that doesnt work here! why is it such problem and how can I fix it?