I would like to copy a file using a procomm script. The problem is, I do not know what the last characters of the file will be at any given day. Is there anyway to pull a file like you would do with the '*'?
We are trying to pull the file from a remote system, yes. We are using the command:
ftp remote copyfile filename
However, because the filename has a timestamp, we cannot specify the exact filename. The doc appears to show this filename cannot contain wildcards. Is there another solution?
Will there be only one of these files on the system, or will there be several that you will need to choose from? Procomm's FTP client doesn't support wildcards, but you can set a remote filter to show just the files that match the filemask you specify. Be aware that some systems don't work well with this setting and may not return a directory listing.
Below is a sample of the code we have used to get the results we want. We only are wanting to pull one file, so we will need to clear the file everytime we pull it.
ftp remote filelist sFileSpec ;Get list of files from FTP server
while $FTPSTATUS ;Loop while file list built
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
if strfind sData fname
ftp remote copyfile sData ;Copy file to FTP site
while $FTPSTATUS ;Loop while file is being copied
yield
endwhile
if SUCCESS ; if transfer successful
ftp local rename sData "c:\edidata\lockbox.dat" ; rename file for UNIX transfer
endif
exitwhile
endif
endif
endwhile
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.