The script I have been working on cleans up ftp images from a bunch a cameras and does this everyday. It deletes directories older than 14 days. The issue I am running accross is that even though there is typically 15k images in each directory, it takes WAY to long to accomplish this. I have tried the following commands and it continues to get bogged down....
fname1 would be the name of the directory.
shutil.rmtree(fname1)
or
cmd_string = "rmdir /s /q %s" % fname1
os.system(cmd_string)
The storage device is a 2 tb raid array on windows server 2008 R2. The memory usage it at 47% and the cache file has been capped 4 gbs (before I capped it, it would take up all the memory). Is there a more efficent way to accomplish this task?