Jump to content

Evaluate If A File Is 0-byte Or Not ?


Recommended Posts

Is there a simple way to evaluate IF some filename is 0-byte or NOT?

I want to use that as a test condition in a cmd batch file.

after reading this http://www.msfn.org/board/index.php?showtopic=13219

i think i got it.

for /f "tokens=4" %%i IN ('dir /-c file.ext ^| find /i "file.ext"') do set z=%%i
if not '%z%'=='0' goto NotZero
if '%z%'=='0' goto Zero

:thumbup

Edited by vcBlackBox
Link to comment
Share on other sites


If you pass a file name as a parameter of a batch file then you can get the file size with this command...

IF %~z1 EQU 0 GOTO Zero

Type FOR /? at command prompt to know all informations you can retreive from %~

Hoping this help

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...