Delete all file in a directory using python

 

files_path=os.path.join(settings.MEDIA_ROOT , 'intermediate',str(request.user))
for root, dirs, files in os.walk(files_path):
for filename in files:
os.remove(os.path.join(root, filename))

Comments

Popular posts from this blog

Setting Up PostgreSQL Database for a Django Project

Create a dataframe by reading a csv and show this in template

Celery vs Channel