Page 1 of 1

deleting zero byte files

Posted: 20 Jun 2006 10:03
by fran
I need some help. I am trying to delete zero byte files. I have a process in my scheduler that starts a job if a file exists however it does not check to see if there is any data in the file.

how do I delete a zero byte file in DOS?

Posted: 23 Jun 2006 19:32
by Guest
Look here: http://dostips.cmdtips.com/DtCodeSnippets.php#_Toc136272773

Code: Select all

set file=filename.txt
dir "%file%"|find /i " 0 %file%">NUL&&(
    echo.%file% has ZERO bytes and can be deleted)


or here: http://dostips.cmdtips.com/DtCodeSnippets.php#_Toc136272772

Code: Select all

set file=filename.txt
for %%a in ("%file%") do if %%~za==0 echo.%file% has ZERO bytes and can be deleted



DOS IT HELP ?