How to move or delete files from a folder containing 2 million files on an NTFS drive?

Posted by Beau on Server Fault See other posts from Server Fault or by Beau
Published on 2010-02-03T18:22:50Z Indexed on 2011/01/02 19:55 UTC
Read the original article Hit count: 266

Filed under:
|
|

The issue is that any modification to the directory locks up Explorer indefinitely, though Samba access to other directories still works. I've tried moving files locally and over Samba.

Even enumerating the directory to get the list of files locks up the computer indefinitely.

I tried using Python's win32file.FindFilesIterator to iterate the files but that also hangs.

My idea was to move each file to a different directory (in a directory above the directory we're dealing with) based on its timestamp, so that we'd have at most a thousand or so files in each directory... But since I can't even enumerate the files, that's been a non-starter.

If I have to give up and just nuke the directory I'm willing to do that, but a standard delete also hangs indefinitely.

I have set these two parameters to increase speed and they also did not help the issue:

R:\>fsutil behavior query disablelastaccess
disablelastaccess = 1

R:\>fsutil behavior query disable8dot3
disable8dot3 = 1

These are all sequential images that would have run into the 'bug' with 8.3 filenames whereby many similarly named files in one directory can take a long time to compute 8.3 filenames. From what I understand this data is stored in the file system even after disable8dot3 is enabled, so it may still be contributing to the problem.

Any ideas?

© Server Fault or respective owner

Related posts about windows-server-2003

Related posts about ntfs