byenow is a command line tool for Windows to delete folders faster
Deleting large folders or collection of files on Windows may take quite some time. The deletion speed depends on a number of factors but even if you have a super fast computer, you may notice that it takes minutes or even hours to delete all selected files.
If you use the command line, you can delete large folders faster in Windows. If you want to speed up that even further, third-party tool byenow may be an option.
The program uses multiple threads to delete the contents of a selected folder quicker and advanced users may select to use the NtDeleteFile API instead of the standard DeleteFile API to reduce the number of syscalls from three to one to speed things up further.
Tip: check out how to add custom user variables to Windows to load folders faster
How much faster is byenow? The developer estimates that the application speeds up the deletion by the factor 2 when compared to the fastest option using rmdir. Performance differs depending on numerous factors including storage device, processor and load, size of folder and files, and type of files.
For network shares, a speed increase by the factor 2 is "all but guaranteed" according to the developer because of network latency playing a role in the process.
Windows users may download the most recent version of byenow from the developer website. It is provided as an archive that includes 32-bit and 64-bit versions of the application.
All it takes after extraction is to run the tool from the command line. A good start is to run byenow /? to get the help text that includes all parameters that the application supports.
Microsoft Windows [Version 10.0.18363.657]
(c) 2019 Microsoft Corporation. All rights reserved.C:\Users\Martin\Downloads\byenow-0.2\64-bit>byenow /?
Faster folder deleter, ver 0.2, freeware, https://iobureau.com/byenow
Syntax: byenow.exe [options] <folder>Deletes a folder. Similar to 'rmdir /s ...', but multi-threaded.
-p --preview enumerate contents, but don't delete anything
-s --staged enumerate contents first, then delete them-1 --one-liner show progress as a single line
-e --list-errors list all errors upon completion
-y --yes don't ask to confirm the deletion-t --thread <count> use specified number of threads
-n --delete-ntapi use NtDeleteFile to remove files* By default the thread count is set to the number of CPU cores. For local folders it doesn't make sense to go above that, but for folders on network shares raising the thread count may be a good thing to try, especially for high-latency connections.
You can use the main command byenow folderpath, e.g. byenow c:\test\ to delete the test folder on the c: partition using as many threads as there are CPU cores.
The parameter --staged lists the folders and files under the specified structure first before they are deleted. It is probably a good idea to use the --preview parameter to run a test without deleting anything.
Other options include adding a confirmation prompt using --yes, change the number of threads using --threads xx, or use the NtDeleteFile API by using --delete-ntapi.
Closing Words
Removals are quick when using byenow and the program may be an option for users who need to delete large folders regularly or want to speed up the deletion of a single large folder once. The source code of the application is available as well.
Now You: How long have you waited the most when deleting folders?
Looks like a cool tool! How do you set it to delete stuff from the context menu, like with your article on fast delete?
Can you give the commands to post in the registry?
Thanks in advance.
You can get something similar by using robocopy
Create an empty directory then robocopy /mir empty some\directory\to\empty and it’ll delete everything. You can add /mt:8 or some other number to increase threads
robocopy /mir is an urban legend of “alternative”. It is several times slower than “rmdir /s”. There’s even a screenshot on byenow’s site that shows that.
Furthermore, /mt will make no difference, it applies only to copying files. All other operations are sequential.
I don’t see anywhere in the article or comments an answer to the big question: WHY does it take Windows so long to delete folders?
(Bonus points: Why is Android so incredibly slow at deleting or moving files?)
The problem with the fast delete approach is that items get removed from the MFT only. However, the files’ data is still left on disk and can be recovered. Also, without properly cleaning the files’ data and the MFT after deletion, fragmentation increases quite a bit over time. Until there is a better tool, SDelete is still the first choice to address these issues and keep the file I/O speedy.
I don’t often do mass purges of folders and files, but when I have, I’ve noticed that they can take a *very* long time. This utility would have come in handy for me around a month or two ago, when I consolidated and “curated” around 20 years of accumulated data from various computers and external drives. I ran into several “parent” folders that took anywhere from 30 minutes to an hour to delete.
A far more annoying problem for me is files whose pathname is too long for the file to be deleted (even permanently). There are workarounds and special utilities for dealing with that, but I’m at a loss to understand how Windows even allows files like that to be written in the *first place* (typically as sync-generated backups).
Right now, I delete about 40,000 small files each week, but that only takes about 4 minutes, and I keep busy doing other tasks.
Also, I doubt my PC is fast enough to provide extra threads for byenow, as I often want most of my CPU power to go to the task I’m focused/working on, as my files get deleted in the background.
One of the most annoying things about Windows is File Explorer and “calculating”. Sometimes it seems as though the calculating takes longer than the actual operation. If only there was an option to not calculate just do it. As for deleting I just use DEL /F /Q /S whatever > NUL, not sure it’s as fast as this but it’s built in and fast enough.
Can it delete locked folders or files? How about encrypted or hidden?
It just speeds up the process which means that it has the same restrictions as other delete operations from the command line.
the fastest way to delete files and folders in large quantity in Windows is via shift+del
Using windows explorer to delete files, will bring the “calculating” window before deletion. For a lot of files this can take a long time.
I know Windows send the trim command after file removal (ever since Vista). I wonder if this bypasses that command. It would not be a really good idea imo.
@Yuliya: Good point, although (as I understand it) not applicable to mechanical hard drives, where really big folders are (probably?) more likely to be found.
Yes, it only applies to solid state drives.
TRIM should be a part of the NTFS file system driver and probably of the SSD controller, too.
In addition, my understanding is that TRIM is not triggered by the deletion of individual files, but it’s an unmap command sent to the SSD when the system is idle, and it affects the entire partitition. The only way to disable it should be a change to the NTFS settings via fsutil DisableDeleteNotify or the registry.
You can force a whole-disk TRIM, but Windows also sends a TRIM command after file deletion only for the affected sectors. This is why you end up with 30+ days of Windows built-in defragment/trim tool since the period it has last run automatically, yet if you force analyse the disk it will tell you the disk is OK and needs no action (in this case being TRIM).
This is actually the only way it is being done in WinVista/7. Only in 8+ you can force full-disk TRIM (natively).
>WinVista/7
Make that Win7 only. I thought WinVista got TRIM support in a SP, I think it didn’t. Not too sure about it, nor I care too much.
I think there’s a typo here: “-1 –one-liner show progress as a single line”, isn’t it -l ?
No it is 1 actually for that.