Subject: | |
From: | |
Reply To: | Emerson, Tom # El Monte |
Date: | Wed, 15 Dec 1999 13:55:24 -0500 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
----- Original Message -----
From: Steve Hammond <[log in to unmask]>
>
> In the past, we would use FTP to access a network server.
> We would do a DIR command on a specific file name.
> We would then exit FTP
> We would then query FTPLASTERR
> If that was not equal 0, then the file did not exist and we
> would branch.
[aside: you don't actually have to exit FTP to check the value and/or react
to it -- FTP supports the use of the ":" like unix uses an "!" to "execute a
shell command/function"; it therefore supports things like ">:if FTPLASTERR
<> 0"]
> Now, whether the file exists or not, the value of FTPLASTERR
> is always 0.
>
> Has anyone else seen this problem?
> We need to know if a file exists on the network.
Here is a brief snippet based on something I have here that uses MPEX to
get/process files on a network server where the HP doesn't neccessarily know
the names on the server:
!purge incoming
!RUN FTP.ARPA.SYS;stdlist=$null
OPEN 192.168.XX.YY
user <USERNAME> <PASSWORD>
cd auth/incoming
ls . incoming
quit
!IF FINFO("INCOMING",0)
<<process the file "incoming"...>>
Basically, the contents of the directory "auth/incoming" on the server are
listed to the local file "incoming"; if that file doesn't exist [or the EOF
is 0], then we know there are no files to process this cycle. (the actual
job then uses MPEX's "%REPEAT / %FORRECS" keywords to perform a set of
actions for each line (record) in the file, hence the reason I actually
"quit" at this point. In your case, you could probably keep the "if
finfo..." inline within FTP)
Tom Emerson
Sr. Systems Analyst
NDC | e COMMERCE
[log in to unmask]
626-258-4309
626-350-3832 FAX
|
|
|