Skip to navigation
Clean a directory with python
07.12.13
import os dirPath = "/home/giu/pyExperiments/toRemove" fileList = os.listdir(dirPath) for fileName in fileList: os.remove(dirPath+"/"+fileName) http://glowingpython.blogspot.com/2011/04/how-to-delete-all-files-in-directory.html
Reply
Anonymous
for root, dirs, files in os.walk(self.app_pic): for name in files: pic = root.replace('../pictures/','') + "/" + name if (pic in pictures): filename = os.path.join(root, name) os.remove(filename)
07.12.13
Reply
Anonymous
Information Epoch 1732526570
Development is an iterative process.
Home
Notebook
Contact us