Re: File Size Check
- From: Tom Lavedas <tglbatch@xxxxxxx>
- Date: Wed, 30 Jan 2008 05:51:28 -0800 (PST)
On Jan 29, 6:24 pm, "Pegasus \(MVP\)" <I....@xxxxxxxxxx> wrote:
"Pete T" <Pe...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:5F353EE6-1A67-427C-B108-9A65A1C04438@xxxxxxxxxxxxxxxx
I have a simple batch file that FTP's out to a server, logs in, retrieves a
file and places it on my server and then here's where I run into a
problem.
When it was written in XP the batch then checked the size of the file and
if
it was greater than 0, the batch ended and was done. If the file was not
greater than 0, it slept for 20 minutes (echo sleep 1200) and then re-ran
the
FTP process.
Now that this is on Windows 2000, I can't figure out how to make it work.
Here are the two files that were run:
@echo on
del para2.txt
echo open XXXXXXXXXXXXXX >> para2.txt
echo user XXXXXXXXXXXXXXXXX >> para2.txt
echo binary >> para2.txt
echo hash on >> para2.txt
echo GET XXXXXXXXX >> para2.txt
echo DEL XXXXXXXXX >> para2.txt
echo quit >> para2.txt
progs.bat abc.123.tag
@echo on
del %1
:START
ftp -n -s:para2.txt
if %~z1 GTR 0 goto :END
sleep 1200
goto :START
:END
del para2.txt
Any ideas on how to make this work in Windows 2000?
Since you're not reporting what exactly happens under
Win2000, it's a little hard to say what's wrong. However,
the batch file below will work both under WinXP and under
Win2000. Note that for ease of maintenance it is now one
single file.
@echo off
set FileName=xxxxxxxxx
set Site=ftp.PeteT.com
set User=PeteT
echo> para2.txt open %Site%
echo>> para2.txt user %User%
echo>> para2.txt binary
echo>> para2.txt hash on
echo>> para2.txt GET %FileName%
echo>> para2.txt DEL %FileName%
echo>> para2.txt quit
if exist %FileName% del %FileName%
:START
ftp -n -s:para2.txt
for %%a in (%FileName%) do if %%~za GTR 0 goto END
ping localhost -n 1200 > nul
goto :START
:end
del para2.txt
First, not that I am offended by your choosing to answer, but why is
this in microsoft.public.scripting.vbscript, since this is entirely a
batch command question? I would think alt.msdos.batch.nt would be a
better NG or even microsoft.public.windows.server.scripting or
microsoft.public.win2000.cmdprompt.admin (though this last one has
extremely low activity).
Second, I think you have probably corrected his problem without
explaining why, which I suspect is the missing SLEEP.EXE utility.
Since there is no useful error information it's hard to be sure.
However, SLEEP is part of the WinNT/2K/XP/2003 Resource Kit and not a
standard part of the OS installation, therefore, it is reasonable to
assume the OP's XP system has it installed and his 2K machine does
not.
Tom Lavedas
===========
http://members.cox.net/tglbatch/wsh/
.
- Follow-Ups:
- Re: File Size Check
- From: Pegasus \(MVP\)
- Re: File Size Check
- References:
- Re: File Size Check
- From: Pegasus \(MVP\)
- Re: File Size Check
- Prev by Date: Re: How can I enumerate services and list the account context under which they run???
- Next by Date: Re: File Size Check
- Previous by thread: Re: File Size Check
- Next by thread: Re: File Size Check
- Index(es):
Relevant Pages
|