Page 1 of 1

Fastest method for deleting massive directories in Windows

Posted: Sun Oct 09, 2022 12:15 am
by Andrew Lee
Something interested I came across if you are looking for a way to delete massive folders in Windows. CLI is the winner :D:

https://tinyapps.org/blog/202210080730_ ... elete.html
This method appears to be the winner:

del /f/s/q folder-name > nul && rmdir /s/q folder-name

Tested on a ~10TB directory (containing many hundreds of thousands of files) residing on a SATA-connected 32TB Windows Storage Spaces SSD array. Total time to deletion: ~10 seconds. On a USB 3.1-connected 32TB RAID 0 HDD array, the process took just over a minute.

Re: Fastest method for deleting massive directories in Windows

Posted: Sun Oct 09, 2022 8:00 am
by SYSTEM
In my experience, deleting huge directories is plenty fast on Windows even in the most obvious "delete in Explorer" method. Deletion of big files is far slower on Linux for whatever reason.

Re: Fastest method for deleting massive directories in Windows

Posted: Sun Oct 09, 2022 4:49 pm
by Andrew Lee
SYSTEM wrote: Sun Oct 09, 2022 8:00 am In my experience, deleting huge directories is plenty fast on Windows even in the most obvious "delete in Explorer" method. Deletion of big files is far slower on Linux for whatever reason.
Hmmm.. my experience is the opposite. If you have a lot of files (>1000) in a folder, deleting it is very slow using the usual method. Shift-Del works slightly faster (probably because the move to Recycle Bin is skipped), but there's still a long pause at the start as Explorer works out all the files to the deleted.

Re: Fastest method for deleting massive directories in Windows

Posted: Sun Oct 09, 2022 11:27 pm
by freakazoid
I've ran into this same problem before, Andrew.

I didn't have to delete 10TB, but using Explorer to delete was painful. The command-line is definitely the way to go for this.

Re: Fastest method for deleting massive directories in Windows

Posted: Mon Oct 10, 2022 5:57 am
by Midas
Andrew Lee wrote: There's still a long pause at the start as Explorer works out all the files to the deleted.
My personal experience is also consistent with this. :|

Re: Fastest method for deleting massive directories in Windows

Posted: Tue Oct 11, 2022 5:47 pm
by Mike.S.G.
10TB, man that's a lot of data to have to monkey with.

I put a 500GB SSD in may laptop in 2019, I still have 458GB left. In fact, I believe I still have every drive I've ever installed in any system stored in a box somewhere, including 2 40GB or 80GB WD that still work... I enjoy every now and then dropping them into an enclosure just to look at what I was doing in 1996 - serves no other purpose. It's sorta a digital scrapbook... doubt I have 1TB of data.

OTH, I could see a need for a tool like this today, many Youtubers who want to keep backups of uploads, they could easily have twice as much data to move - YIKES!

Re: Fastest method for deleting massive directories in Windows

Posted: Tue Oct 11, 2022 8:05 pm
by Andrew Lee
It's not larges files, it's lot of small files.

For example, I keep all the photos/videos taken over the past 20y on my HDD. The total size is only about 200GB, but there are >100k files in there (sorted into subfolders I may add).

I keep incremental backups on some other HDDs. Sometimes when I have to delete the entire folder of >100k files on the backup drives, the Explorer method will take a very long time!

Re: Fastest method for deleting massive directories in Windows

Posted: Wed Oct 12, 2022 12:00 am
by Special
Agreed with Andrew, for example after ever Windows update there is a folder worth cleaning (as in deleting) because Windows is terrible at cleaning up after its self... Anyway the folder in question is "C:\Windows\servicing\LCU\Package_for_RollupFix~XXXXXXXXXXXXX", inside that folder is just over a GB or so of files and folders, but many, in the 40-75K range. It takes ages for explorer.exe to delete them.

Re: Fastest method for deleting massive directories in Windows

Posted: Fri Oct 14, 2022 4:36 pm
by Mike.S.G.
Andrew Lee wrote: Tue Oct 11, 2022 8:05 pm It's not larges files, it's lot of small files.

For example, I keep all the photos/videos taken over the past 20y on my HDD. The total size is only about 200GB, but there are >100k files in there (sorted into subfolders I may add).

I keep incremental backups on some other HDDs. Sometimes when I have to delete the entire folder of >100k files on the backup drives, the Explorer method will take a very long time!
I hear ya.

I wasn't really focused on file sizes - large versus small, rather, IMO it would seem one of the quickest ways to get to 10TB (or much more) of data was by managing a large database of video files in HD or UHD, etc. True though, for a professional photographer who keeps a database of their work, and knowing how large a tiff, raw, or psd file can be, managing a database of images could get one to 10TB (or much more) of data very quickly as well.

Again, for my purposes here, size doesn't matter :mrgreen: