Hi,
I have the following problem: I want to delete a subdirectory but after deleting and rescaning the files the subdirectory is still there.When I look in my directory it is gone, so why does it find it again?
def rescan():
scan_Files=[]
def walker(arg, dir, path):
scan_files.append(dir)
for val in path:
pathname = dir + os.sep + val
if os.path.isfile(pathname) == 1:
scan_files.append(dir + os.sep + val)
os.path.walk(pathDir, walker, None)
return scan_files
rescan()
def recursive_delete(dirname):
files = os.listdir(dirname)
for file in files:
path = os.path.join (dirname, file)
if os.path.isdir(path):
recursive_delete(path)
else:
retval = os.unlink(path)
os.rmdir(dirname)
recursive_delete("/home/tools/beveronic")
rescan()
I have the following problem: I want to delete a subdirectory but after deleting and rescaning the files the subdirectory is still there.When I look in my directory it is gone, so why does it find it again?
def rescan():
scan_Files=[]
def walker(arg, dir, path):
scan_files.append(dir)
for val in path:
pathname = dir + os.sep + val
if os.path.isfile(pathname) == 1:
scan_files.append(dir + os.sep + val)
os.path.walk(pathDir, walker, None)
return scan_files
rescan()
def recursive_delete(dirname):
files = os.listdir(dirname)
for file in files:
path = os.path.join (dirname, file)
if os.path.isdir(path):
recursive_delete(path)
else:
retval = os.unlink(path)
os.rmdir(dirname)
recursive_delete("/home/tools/beveronic")
rescan()