Check file size in batch file

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
klkemp100
Posts: 1
Joined: 24 Nov 2009 09:52

Check file size in batch file

#1 Post by klkemp100 » 24 Nov 2009 10:00

Trying to write a batch file that will check the size of a file, and based on it's size do something.

Here is the scenario:

1. errorfile.txt is created by a computer application and placed in the c:\errors directory. sometimes this file has a size of 0 <zero> and sometimes it can be rather large in size

2. i would like to have a batch file check the size of this file and do the following:

if filesize of c:\errors\errorfile.txt = 0
run batchfile filesize0.bat
else
run batchfile filesizenot0.bat

thanks in advance for your help on this.

ghostmachine4
Posts: 319
Joined: 12 May 2006 01:13

#2 Post by ghostmachine4 » 24 Nov 2009 23:19

read for /? and you can find the answer

Post Reply