Page 1 of 1

Need to check file size through batch script.

Posted: 04 Jul 2013 23:43
by sankasu
Need to check the size of the file and if file size is '0' bytes then do things

Re: Need to check file size through batch script.

Posted: 05 Jul 2013 02:29
by npocmaka_

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
)