Friday, April 10, 2020

Testing This Awesomeness Out Right Now

HOLY CRAP! THIS WILL BE AWESOME, if it works!

On Recursively delete empty directories in Windows, which was asked 10 years, 7 months ago, this solution was posted:

You can also use ROBOCOPY. It is very simple and can also be used to delete empty folders inside large hierarchy.

ROBOCOPY folder1 folder1 /S /MOVE

Here both source and destination are folder1, as you only need to delete empty folders, instead of moving other files to different folder. /S option is to skip copying(moving, in the above case) empty folders. It is also faster as the files are moved inside the same drive.

I'm currently testing out this idea now in a test directory structure and, thus far, it's working great. I created two files in Notepad and put each file in a separate folder. This means that when the above command is complete, if I have one folder with a single sub-folder under, each folder with a total of two files, I can add the above command to every DOS batch file I have ever created that uses "md" (make a directory) commands!

No comments: