Pastebin
Paste #2579: rmrf
< previous paste - next paste>
Pasted by tdn
def rm_rf(self, d):
self.print_debug("rm_rf: Removing %s", d)
for path in (os.path.join(d,f) for f in os.listdir(d)):
if os.path.isdir(path):
self.rm_rf(path)
else:
os.unlink(path)
os.rmdir(d)
def delete_file_from_fs(self, fileid, filename):
filepath = os.path.join(self.fileroot, fileid)
self.print_note("Deleting file %s from file system", filepath)
self.rm_rf(filepath)
#######
res = self.db.query(query)
for f in res:
self.delete_file_from_db(f[0])
self.delete_file_from_fs(f[0], f[1])
New Paste
Go to most recent paste.