vcBlackBox Posted March 18, 2005 Share Posted March 18, 2005 (edited) 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=13219i think i got it. for /f "tokens=4" %%i IN ('dir /-c file.ext ^| find /i "file.ext"') do set z=%%iif not '%z%'=='0' goto NotZeroif '%z%'=='0' goto Zero Edited March 18, 2005 by vcBlackBox Link to comment Share on other sites More sharing options...
jdoe Posted March 18, 2005 Share Posted March 18, 2005 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 ZeroType FOR /? at command prompt to know all informations you can retreive from %~Hoping this help Link to comment Share on other sites More sharing options...
vcBlackBox Posted March 22, 2005 Author Share Posted March 22, 2005 Thanks jdoe.though, it took me awhile to figure out the correct syntax. Link to comment Share on other sites More sharing options...
jdoe Posted March 23, 2005 Share Posted March 23, 2005 Thanks jdoe.though, it took me awhile to figure out the correct syntax.<{POST_SNAPBACK}>Sorry to have not been very clear on this one Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now