Checking If A File Is Zero Byte in Windows batch

@echo off
setlocal
set FILE=%1
if not exist %FILE% goto :END
for /f "tokens=1-5" %%a in ('dir %FILE%') do call :CHECKFILE %%a %%b %%c %%d %%e
goto :END
:CHECKFILE
if not {%5}=={%FILE%} goto :EOF
if {%4}=={0} ( echo It's a zero byte file! ) else ( echo It's not a zero byte file )
goto :EOF
:END

Comments

Popular posts from this blog