In the work I do, I often have to rename and delete folders.

Shift-deleting a folder goes pretty quickly - perhaps 10-20 seconds for 1-2GB, while renaming the same folder occurs instantly.

My understanding is that when I shift-delete a folder, Windows is going through the file index and saying 'space x to y is no longer occupied by these files'.

Naively, I figured that Windows would have to do a similar process for a folder rename - changing the windows path on the file index.

Can someone perhaps give a high level overview of what's going on with windows when it renames and deletes folders?


Renaming a folder (or file) requires:

  • checking that the new name does not already exist in the parent folder;
  • overwriting the name in the appropriate directory entry.

No subfolders or files in the renamed directory tree are affected in any way.

Deleting a directory requires:

  • traversing the directory tree to find each file in each subdirectory;
  • checking each file is not in use and deleting it by patching its directory and marking the space it used as available in the disc allocation table;
  • once all the files have been removed from a subdirectory, deleting the directory and making its space available, as for a file;
  • continuing this process until eventually the original directory is deleted.

The time to delete a directory therefore depends on the number of files and subdirectories, and the size and degree of fragmentation of each.

On the other hand, moving a directory to a different disc or partition requires the creation and copying of each file in each subdirectory, as well as the deletion of the source directory.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.