0

I am currently faced with a problem, where I need to be able to launch another batch file if a file is under 10KB.

E.g. If xxxxx.txt is greater than 10KB launch stage2.bat

May
  • 1
  • 1
  • 2

2 Answers2

0

This bat file checks whether the file size of xxxxx.txt is greater than 10KB (10280 bytes) and can assign some tasks depends on the result.

@echo off
cd C:\MyFolder\
set file="xxxxx.txt"

set maxbytesize=10280

FOR /F "usebackq" %%A IN ('%file%') DO set size=%%~zA

if %size% GTR %maxbytesize% (
    //do stuff
) ELSE (
    //do stuff
)
rchacko
  • 1,965
  • 23
  • 24
0
for %%X in (file.foo) do if %%~zX GTR 10240 call stage2.bat
Joey
  • 344,408
  • 85
  • 689
  • 683