Here's the edited procedure from that script, I cut out some of the extraneous stuff. Some of the variables referenced in the script were globals, so you won't see them declared in this script. It's been a couple years since I've been in this code, but I hope it's stood up OK!
A brief synopsis - the code dials the FTP Connection Directory entry named FaxForward, has some code that determines if the connection was successful or not (similar to what you use for sendfile/getfile with data connections), copies a ZIP file to the server, retrieves the filelist from the FTP server, parses the text file for the ZIP file that was just uploaded (to verify the upload was successful, I believe this was due to the ftp ASPECT command not accurately returing success/failure), and deletes the local ZIP file if the file is on the FTP server. sAlert was a global variable that I updated in a dialog box. I've left these commands in due to the comments possibly being useful. The only change I see that is needed off the top of my head is FTPSuccess needs to be reset somewhere in the procedure. This is probably due to this variable being reset by another procedure.
proc ftpforward ;Procedure to email received faxes, requires FaxForward entry in Connection Directory
integer iStatus ;Integer to hold $FTPCONNECT results
string sData ;String to hold data from filelist file
string sFileSpec ;String to hold path and name of filelist data
dial FTP "FaxForward" ;Make connection to FTP site
iStatus = $FTPCONNECT
while (iStatus < 2) ;Wait until connection is established
yield
iStatus = $FTPCONNECT
endwhile
pause 1
switch iStatus
case 3
sAlert = "Failed to connect to FTP site" ;Print alert message if connect was not successful
endcase
case 2
sAction = "Connected, uploading to FTP site" ;Print success message if connect was successful
ftp local chdir sFaxInbox ;Change local drive to fax inbox
ftp local copyfile sZipName ;Copy ZIP file to FTP site
while $FTPSTATUS ;Loop while file is being copied
yield
endwhile
sendkey 0x74 ;Send F5 to Procomm to refresh directory listing
pause 10 ;Pause to let refresh occur
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 strfind sData sZipName ;If filename matching that of uploaded fax file is found
if delfile sFullZipName ;Delete local copy of fax file
iFTPSuccess = 1 ;Set success flag to true
else ;Unable to delete local ZIP file
sAlert = "Unable to delete local ZIP file" ;Print failure message
endif
exitwhile ;Don't bother searching rest of file
endif
endwhile
fclose 0 ;Close file
delfile sFileSpec ;Delete local copy of FTP filelist
if !iFTPSuccess ;File not uploaded successfully
sAlert = "Failed to upload file to FTP site" ;Print failure message if file was not uploaded successfully
endif
endcase
endswitch
disconnect ;Disconnect from FTP server
endproc