How to list empty files using cmd.ext


  1. Posts : 4
    Windows 7 Home Premium 64bit
       #1

    How to list empty files using cmd.ext


    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


  2. Posts : 721
    Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
       #2

    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


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 18:22.
Find Us