This tutorial explains how to save paths of empty folder to a file. If you need to save empty folder paths to a text file, to know the path of every empty folder on the go, then this tutorial is surely going to help you a lot.
Here, I will demonstrate two methods of saving paths of empty folders. In the first method, I will use EmptyFolderNuker tool to directly save the paths of all the empty folders and sub-folders of a location. In the second method, I will use a batch file to do the same, and this method does not require any third party software.
Both of them can also show paths of hidden empty folders and sub folders. Now lets see how both of them work.
You can also take a look at these 5 best software to delete empty folders for Windows 10 for deleting empty folders.
EmptyFolderNuker is basically a software to detect empty folders and sub-folders, and delete them. However it is also very useful to save paths of all the empty folders. It is a portable file so you just need to download its executable file and run it. Once its open, you need to provide it a location where you want to find the empty folders. Then it shows all the results of empty folders and subfolder, even the hidden ones. Here on result window you will see Save Checked Files To Text File option on top right side of the window. So, all you need to do now is click on that option and a new text file containing paths of all the empty files will appear in the location where the executable file of this folder exists. So easy, isn’t it!
Batch File Method:
In this method to save empty folder paths to text file you will need to use the following code:
for /d /r %1 %%A in (.) do (
dir /a /b "%%~fA" 2>nul | findstr "^" >nul || echo %%~fA
First you will need to copy and paste this code to a new file in notepad, and then save the file with any name and .cmd extension. You also need to choose All Files under Save As Type. You always need to save the .cmd in the location whose empty folder paths you want to save as a text file.
Once the .cmd file is created, you need to open Command Prompt and load the location where .cmd file is saved and the run,
"CommandName.cmd > output.txt" command. As soon as you run this command a text file with name output.txt appears in the same location with list of empty folder paths. This list will have paths of hidden empty folders.
Both these methods are equally effective in listing empty folder paths as a text file. If you feel uncomfortable using Command Prompts like me, then EmptyFolderNuker is the easiest method for this.