Here's a script that should do the trick for you. You'll want to modify lines 11 and 12 so that the FTP path (if the default path when you connect is not the desired directory) and Connection Directory entry to connect to are defined.
proc main
integer iStatus ;Integer to hold $FTPCONNECT results
string sPath ;FTP path to download files from
string sData ;String to hold data from FTP filelist
string sFileSpec ;String to hold path and name of filelist data
string sConnection ;Connection Directory entry we wish to dial
sFileSpec = $PWLOCALPATH ;Set path to Procomm Plus directory
strcat sFileSpec "\FILELIST.TXT" ;Add filename to path
sPath = "" ;Set path that we want to download from
sConnection = "" ;Connection Directory entry to connect to
dial FTP sConnection ;Make connection to FTP site
iStatus = $FTPCONNECT
while (iStatus == 1) ;Wait until connection is established
yield
iStatus = $FTPCONNECT
endwhile
pause 1
switch iStatus
case 3
;Connection attempt failed, perform error handling
endcase
case 2
if not nullstr sPath ;If path on FTP server specified
ftp remote chdir sPath ;Change to that remote directory
endif
ftp remote filelist sFileSpec ;Get list of files from FTP server
while $FTPSTATUS
yield
endwhile
fopen 0 sFileSpec READ TEXT ;Open list of files from FTP server
while not feof 0 ;Loop while file still has data
fgets 0 sData ;Get line of data from file
if not nullstr sData ;If line is not blank
ftp remote copyfile sData ;Copy file to FTP site
while $FTPSTATUS ;Loop while file is being copied
yield
endwhile
endif
endwhile
fclose 0 ;Close file
delfile sFileSpec ;Delete local copy of FTP filelist
endcase
endswitch
disconnect ;Disconnect from FTP server
endproc
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.