deleting zero byte files

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
fran

deleting zero byte files

#1 Post by fran » 20 Jun 2006 10:03

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?

Guest

#2 Post by Guest » 23 Jun 2006 19:32

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 ?

Post Reply