How Can I Enumerate All the Zero-Byte Files in a Folder Tree?

By | 2006-09-25

I have scripted ZeroByte.bat to list the fully qualified file names of all zero-byte files in a folder tree.

The syntax for using ZeroByte.bat is:

[call] ZeroByte Folder

Where Folder is the folder path to enumerate.

ZeroByte.bat contains:

@echo off
if {%1}=={} @echo ZeroByte Folder&goto :EOF
if not exist %1 @echo ZeroByte - %1 not found.&goto :EOF
setlocal
for /f "Tokens=*" %%i in ('dir %1 /s /a /b /a-d') do (
if %%~zi==0 @echo "%%i"
)
endlocal
Author: dwirch

Derek Wirch is a seasoned IT professional with an impressive career dating back to 1986. He brings a wealth of knowledge and hands-on experience that is invaluable to those embarking on their journey in the tech industry.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.