Help with DOS batch - TechRepublic
Question
October 1, 2010 at 12:31 PM
jutpro

Help with DOS batch

by jutpro . Updated 15 years, 9 months ago

I have the below DOS batch that checks the length of every file in the temp folder and display the file name(s) of any file with zero bytes. In addition, if there are no files in the directory the message ?No Files in folder? will be displayed.

I need this batch file to do an additional task;If files are in the folder and all are greater than zero bytes I would like to echo a message, ?No Empty Files found?.
Everything I have tried have not worked. Any help will be greatly appreciated.

@ECHO OFF
CD C:\temp
if exist *.* goto CHKFILELEN
if not exist *.* goto MESSAGE

:CHKFILELEN
for %%f in (*.*) do (if %%~zf lss 1 echo %%f)
goto END

:MESSAGE
echo “No Files in folder”
goto END

:END

This discussion is locked

All Comments