How do you find all empty directories using batch script?
I have a folder called "shows" on my desktop. Inside it has many sub directories. Some directories are empty and other have some files in them.
How can I loop though all the sub folder and print all folders which are empty?
Below is what I have tried. Issue is that it prints out all folders… even if a sub folder is not empty.
@echo off
SET "MYPATH=C:\Users\dave\Desktop\shows"
for /d %%a in ("%mypath%\*") do (
dir /b /s "%MYPATH%"
pause
)
pause
Best Answer
Here is one way.
From the command line:
Using a batch script: