GTR than command doesnt have any effect.

October 26, 2011 at 20:27:11
Specs: Windows 7
This is my code, its like 5 lines.

I lied...3.
In the working directory, I want to move all *.mkv that are greater than 4 gigs to the "empty" folder. Inside the working directory, I have 3 *.mkvs for testing. One is 8 GB, one is 700Mb and one is 0Kb.

FOR %%F IN (*.mkv) DO (
IF %%~zF GEQ 4000000000 MOVE "%%F" "empty"
)

Obviously anything greater than 4gb with *.mkv extention will be moved to "empty" and anything less wont.

When I run the script this is what happens. I wonder if it's the size of the file it's having trouble with. If I could somehow cut some of it off, instead of 8 gb being 8000000000, make it 8000000, it would work better. Check it out:

D:\BluRay>test.bat

D:\BluRay>FOR %F IN (*.mkv) DO (IF %~zF GEQ 4000000000 MOVE "%F" "empty" )

D:\BluRay>(IF 7032950988 GEQ 4000000000 MOVE "c-african.cats.1080.mkv" "empty" )

1 file(s) moved.

D:\BluRay>(IF 0 GEQ 4000000000 MOVE "file1.mkv" "empty" ) <-- GOOD! Didn't get moved!!!


D:\BluRay>(IF 734177280 GEQ 4000000000 MOVE "sweet.The.Ugly.Truth.2009.mkv" "empt
y" )
1 file(s) moved.

The condition is not true? Why does it continue?!?!?!?!? Driving me insane.


See More: GTR than command doesnt have any effect.

Report •


#1
October 26, 2011 at 20:40:17
I just realized, the highest number I could use is GTR 2100000000

Anything after that has no bearing.


Report •

#2
October 26, 2011 at 22:53:18
also try putting this at the very first line
setlocal enabledelayedexpansion
setlocal enableextension

Report •

#3
October 27, 2011 at 06:00:46
zstat69: Obviously anything greater than 4gb 3.725GB with *.mkv extention will be moved to "empty" and anything less wont.
FIFY. A gigabyte is 2 to the power of 30 bytes, aka 1,073,741,824 bytes.

zstat69: I wonder if it's the size of the file it's having trouble with.
Correct! Any file size 2GB or greater (real GB, as in 1,073,741,824 bytes) will not be considered a number, and will force CMD to perform a text comparison. In your last case, "7" is greater than "4", thus the test was validated as true.

How To Ask Questions The Smart Way


Report •

Related Solutions


Ask Question