Fastest method for deleting massive directories in Windows

Share interesting information or links related to portable apps here.
Post Reply
Message
Author
User avatar
Andrew Lee
Posts: 3063
Joined: Sat Feb 04, 2006 9:19 am
Contact:

Fastest method for deleting massive directories in Windows

#1 Post 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.

User avatar
SYSTEM
Posts: 2043
Joined: Sat Jul 31, 2010 1:19 am
Location: Helsinki, Finland

Re: Fastest method for deleting massive directories in Windows

#2 Post 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.
My YouTube channel | Release date of my 13th playlist: August 24, 2020

User avatar
Andrew Lee
Posts: 3063
Joined: Sat Feb 04, 2006 9:19 am
Contact:

Re: Fastest method for deleting massive directories in Windows

#3 Post 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.

freakazoid
Posts: 1212
Joined: Wed Jul 18, 2007 5:45 pm

Re: Fastest method for deleting massive directories in Windows

#4 Post 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.
is it stealth? ;)

User avatar
Midas
Posts: 6727
Joined: Mon Dec 07, 2009 7:09 am
Location: Sol3

Re: Fastest method for deleting massive directories in Windows

#5 Post 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. :|

User avatar
Mike.S.G.
Posts: 79
Joined: Mon Nov 26, 2012 6:58 pm

Re: Fastest method for deleting massive directories in Windows

#6 Post 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!

User avatar
Andrew Lee
Posts: 3063
Joined: Sat Feb 04, 2006 9:19 am
Contact:

Re: Fastest method for deleting massive directories in Windows

#7 Post 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!

Special
Posts: 219
Joined: Wed Aug 14, 2013 7:22 am

Re: Fastest method for deleting massive directories in Windows

#8 Post 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.

User avatar
Mike.S.G.
Posts: 79
Joined: Mon Nov 26, 2012 6:58 pm

Re: Fastest method for deleting massive directories in Windows

#9 Post 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:

Post Reply