1.

Solve : command to find the file size?

Answer»

Hii
Can some tell me how to write code for the below requirement in a BATCH file

 1>get the current size of  file.
 2> hold the current size in a variable
 3> wait for few secs
 4>again get the file size and hold in another variable 
 5> now compare the both the variables
 6> if size is same proceed else repeat the loop


I want to write this code in a batch file can some tell me how to write this

echo off
set filename=D:\folder\subfolder\filename.ext
set seconds=60
for %%S in ("%filename%") do set /a filesize1=%%~zS
:loop
ping -n %seconds% 127.0.0.1 >nul
for %%S in ("%filename%") do set /a filesize2=%%~zS
if "%filesize1%" NEQ "%filesize2%" GOTO loop

Hi
Thanks for the reply but can plz explain me what
ping -n %seconds% 127.0.0.1 >nul
line is doing ..
do I need to change this when  I move from one system to another
I very new to batch files hence.. Quote from: Fire_Hope on November 13, 2008, 11:50:46 AM

plz explain me what
ping -n %seconds% 127.0.0.1 >nul
line is doing ..

It uses the ping command to create a time delay.

use ping /? to find out about the command.

Quote
do I need to change this when  I move from one system to another

No.
Hii
I tried the code which you mentioned
but its giving me error as Missing Operand.
and when I turned on the Echo
its showing me the following lines

C:\>set /a filesize2=
Missing operand.

C:\>if "" NEQ "" goto loop

can you tell me where the problem is ??the drive letter, path, filename are pointing to a non existent file.

So.. can't I use this code to find the file info on another system(not a LOCAL drive) , 'coz the location at which I have the file is not local
I am accessing the file like this
 \\mystoragebox\webpages\info\data.txt

when I tried with some thing in my D Drive or so .. its working but when I try for the path i mentioned, its failing

how should I make it working for the file on remote box





Discussion

No Comment Found