How to list empty files using cmd.ext

rkariff

New member
Local time
7:07 AM
Messages
4
Hello.

I am in need of listing all the empty folders on a subfolder. Cmd.exe seems like it would be the perfect route to go.

In the past, I have listed all the files in a directory to a text file.

I am looking to do the same with empty folders, as I need to know if I'm missing audio, video, or pictures, that were supposed to be there. And then replace accordingly.

So something like sending a list of empty folders to a file named empty.txt is along the lines that I'd like.

If anybody can help. Please do.

Thanks.
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
HP
OS
Windows 7 Home Premium 64bit
Browser
Google Chrome
Hi Rkariff,

Here's some batch script that may help you--
Code:
set start_location="C:\Users\%USERNAME%"
set empty.txt_location="C:\Users\%USERNAME%\Desktop\empty.txt"
 
(
    @for /f "delims=" %%I in (' dir /a:d /b /s %START_LOCATION% ') do @(
        dir /a /b "%%~fI" 2>NUL | find /v "" >NUL || (
            echo "%%~fI"
        )
    )
) > %EMPTY.TXT_LOCATION%
 

My Computer

Computer type
PC/Desktop
OS
Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
Back
Top