I am back after few years trying to familiarize with some codes we made here in past. I am running one script which should detect file size at its start. It looks like this:
Code: Select all
@echo off
REM REQUIREMENTS: CURL, GREP
Setlocal EnableDelayedExpansion
SET proxy_1=proxy_samai_ru_1.htm
SET source_1=http://www.samair.ru/proxy/
CHCP 1250 > NUL
for /f "delims=" %%x in (delimiter.ini) do set TAB=%%x
if not exist !proxy_1! (
echo File not found. Dounloading from !source_1!
curl -o !proxy_1! !source_1! -H user_agent="User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100214 Ubuntu/9.10 (karmic) Firefox/3.5.8"
pause
exit
)
echo off
for %%I in (!proxy_1!) do SET filesize=%%~zI
echo Filesize !filesize! B
if !filesize! LSS 2000 (
echo File is too small, suspected server denied to send data. Download manually from !source_1!
pause
)
echo reading !proxy_1!
What it prints to me is:
Filesize 11208 B
File is too small, suspected server denied to send data. Download manually from
http://www.samair.ru/proxy/
press any key...
Which is not correct becaue filesize 11208 should be greater then 2000, so the error should not happen. What's wrong?