Need to check file size through batch script.

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
sankasu
Posts: 1
Joined: 04 Jul 2013 23:30

Need to check file size through batch script.

#1 Post by sankasu » 04 Jul 2013 23:43

Need to check the size of the file and if file size is '0' bytes then do things

npocmaka_
Posts: 512
Joined: 24 Jun 2013 17:10
Location: Bulgaria
Contact:

Re: Need to check file size through batch script.

#2 Post by npocmaka_ » 05 Jul 2013 02:29

Code: Select all

@echo off
if exist "filename" (
  for %%F in ("filename") do set "file_size=%%~zF"
)

if defined file_size if %file_size%0 NEQ 00  (
  do something
) else (
  do something else
)

Post Reply