Hi! I need to determine empty folders within a given file location (e.g. C:\test\) and output the empty folder file names to an output file (e.g. C:\test\output.txt).
I have this code for the batch file however I can only echo ALL the folders to the txt file. I only need the empty folder file names to be echoed.
pushd C:\test
for /d %%d in (*) do (
rd /q %%d
echo %%d >> c:\test\output.txt
)
popdCan someone assist me with this?
Thanks!
@echo off pushd \test type nul > output.txt for /D %%j in (*) do ( dir /B "%%j" > empty.tmp for %%z in (empty.tmp) do if %%~zz equ 0 ( echo.%%j>> output.txt rd /Q "%%j" ) ) del empty.tmp popd
Yes (14) | ![]() | |
No (14) | ![]() | |
I don't know (15) | ![]() |