Fast File Deletion On Windows
Mar. 5th, 2011 02:24 am![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
I frequently need to delete large numbers of files. For example, when I want to do a clean build of our product I have to delete the old build, which is a directory tree containing upwards of 90,000 files totalling several gigabytes of disk space. On Linux and OS X this is a snap: the 'rm -rf' command takes a little under a minute to delete the whole shebang.
On Windows it's a much slower process. First, I "delete" the directory by selecting it and hitting the delete key. That doesn't really delete the files, though, it just copies them to the Recycle Bin, which can take a couple of minutes. The directory tree is still present on the disk, consuming all those gigabytes of space. So now I have to empty the Recycle Bin, which takes another couple of minutes.
Today I found out about the neat trick of holding down the left Shift key when pressing the delete key. That causes the files to really be deleted, not moved to the Recycle Bin. That gets rid of one step and cuts the time to delete files roughly in half. That's still about five times as long as it takes on Linux or OS X, thanks to Windows' hideously inefficient file system, but that's still better than the ten times as long that I've had to put up with until now.
On Windows it's a much slower process. First, I "delete" the directory by selecting it and hitting the delete key. That doesn't really delete the files, though, it just copies them to the Recycle Bin, which can take a couple of minutes. The directory tree is still present on the disk, consuming all those gigabytes of space. So now I have to empty the Recycle Bin, which takes another couple of minutes.
Today I found out about the neat trick of holding down the left Shift key when pressing the delete key. That causes the files to really be deleted, not moved to the Recycle Bin. That gets rid of one step and cuts the time to delete files roughly in half. That's still about five times as long as it takes on Linux or OS X, thanks to Windows' hideously inefficient file system, but that's still better than the ten times as long that I've had to put up with until now.