Hi Team,
I am a new bee to batch script!!
i want to check the size of a file which is in a location (its a dynamic file so it should be like %.zip file)
please give me some suggestions..
thanks in advance!
-Eshwar
how to check the file size of a file
Moderator: DosItHelp
-
- Posts: 10
- Joined: 08 Mar 2011 08:54
Re: how to check the file size of a file
This should show you the file size of every file in that directory in bytes. And the total size of the directory.
I think this is what you meant.
@echo off
Set /a Total=0
Set /a Size=0
echo =======================================
for /f "tokens=*" %%I in ('dir /b') do (
Call :TotalSize %%~zI
echo %%I %%~zI
)
Echo .
Echo Total %Total%
Echo .
echo =======================================
pause
goto :EOF
:TotalSize
set Size=%1
Set /a Total=%Total%+%Size%
goto :EOF
I think this is what you meant.
@echo off
Set /a Total=0
Set /a Size=0
echo =======================================
for /f "tokens=*" %%I in ('dir /b') do (
Call :TotalSize %%~zI
echo %%I %%~zI
)
Echo .
Echo Total %Total%
Echo .
echo =======================================
pause
goto :EOF
:TotalSize
set Size=%1
Set /a Total=%Total%+%Size%
goto :EOF