chirag
chirag

Reputation: 11

Find file size using command line

I m trying to create batch script where i need to check the filesize of test.html file present in my download folder.If filesize is equal to some value then execute say ABC command and if filesize is equal to different value then execute some different command Please Suggest me syntax or example

Upvotes: 0

Views: 506

Answers (1)

npocmaka
npocmaka

Reputation: 57252

@echo off
set "file_path=test.html"
for %%# in ("%file_path%") do set file_size=%%~z#
if %file_size% EQU 190 (
   call some_command
) else (
   call some_other_command
)

Mind that the %file_size% will be in bytes.

Upvotes: 1

Related Questions