byenow

byenow is a command-line Windows utility for faster folder removal.



The program uses multiple threads to enumerate and delete the contents of specified folder. It interfaces directly with Native API and employs a lockless, IOCP-based dispatch to distribute the work between threads.

It also has an option of using NtDeleteFile API, which allows deleting a file with a single syscall vs. three syscalls needed by the standard DeleteFile API.

In other words, it attempts to speed up bulk deletion by using lighter requests and having several of them "in flight" at all times.

Stock options

There are several ways to delete a folder using stock Windows tools. On the command line side we have:

rmdir /s /q folder ref

del /f /s /q folder   followed by   rmdir /s /q ... ref

robocopy /mir empty-folder folder /log:nul ref



There are also PowerShell analogs of the same. They aren't faster.

And finally there's Windows Explorer that beats them all in the race for the last place, taking nearly 70 seconds to do the same job.

Local folders

For local folders byenow may show a speed up of 2x or it may be the same as rmdir. It all depends on the state of the file cache, size of the folder, type of the device (HDD or SDD), overall machine load, etc.

It is really quite hard to get an accurate comparision of any two methods due to how many setup-specific variables there are in play that add a lot of volatility to the measurements.

Network shares

For remote folders however the speed up of 2x is all but guaranteed. This has to do with the network latency that causes the remote end to sit idle while our requests are traveling to and back from it.

By running multiple requests in parallel we can fill the network pipe so that the remote end will always have another request to process once it's done with its current one.

Download

The program is freeware. The archive includes both 32-bit and 64-bit binaries.

byenow-0.12.zip   |   209KB

Released on Feb 20, 2024

Options

By default, byenow will use as many threads as there are CPU cores and it will scan the folder and delete things simultaneously.

--staged will cause the program to first scan the folder and start deleting the contents next.



--preview will cause the program just to scan the folder.



--threads 13 will set the thread count to 13.

--yes will suppress the confirmation prompt.

--yolo will allow deleting C:\Windows, C:\Users and their children.

--omni-delete will allow for a path that points at a file.

--keep-folder will not delete the folder itself, just the contents.

--delete-ntapi will cause files to be removed with NtDeleteFile.

--list-errors will output details of all errors if any encountered.

--one-liner will show the progress as a single line.



--show-bytes will show the size of all found / deleted files.



The program understands if its output is being redirected, in which case it will not display any progess at all, but output only a summary on completion.

Exit codes

On successful completion with no errors the program will exit with 0.

If it completes with errors, it will exit with 10 + log₁₀ (error-count).

It will also return 2 on Ctrl-C, 3 or 4 if it crashes and a variety of other codes if it doesn't like the arguments, etc. For details see the source code.

Source code

Source of the program is available at the link below.

Note however that the source is incomplete due to being dependent on several libraries that are not included in the release. These libraries are simple Win32 API wrappers, so their function should obvious just from the function names.

Github repo

Contact

Questions, issues, bugs or suggestions - hesitate not.