Re: File Size Check



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/
.



Relevant Pages

  • Re: File Size Check
    ... the batch ended and was done. ... del para2.txt ... echo open ... SLEEP is part of the WinNT/2K/XP/2003 Resource Kit and not a ...
    (microsoft.public.scripting.vbscript)
  • Re: Scheduled Task error code:The task completed with an exit code
    ... echo %fileDATE%>filedate.txt ... if exist concatdate.txt del /q concatdate.txt ... You consistently fail to specify a drive and a path for your ... *** You must specify the exact file locations. ...
    (microsoft.public.windows.server.general)
  • Re: File Size Check
    ... the batch ended and was done. ... del para2.txt ... echo open ... echo>> para2.txt GET %FileName% ...
    (microsoft.public.scripting.vbscript)
  • Re: cc65 and "Hello World"
    ... There is a section in the Aztec C ReadMe about starting Aztec C SYS ... Many ProDOS system programs created using Aztec C65 will crash ... del time.r ... @echo cinit.ovr now created! ...
    (comp.sys.apple2.programmer)
  • Re: find and remove duplicate files
    ... > What are those strings of characters? ... echo commands. ... wit a "del " ...
    (microsoft.public.win2000.cmdprompt.admin)