Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using wildcards with Procomm

Status
Not open for further replies.

vizman

MIS
Apr 26, 2005
8
US
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 '*'?

FILENAME*

would pull over a file called FILENAME123

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

 
I have found a solution.

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

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top