proc main integer iStatus ;Integer to hold $FTPCONNECT results string sLocalPath ;Local path to upload files from string sRemotePath ;FTP directory to upload to string sFileMask ;Holds file mask for files to upload string sConnection ;Connection Directory entry we wish to dial sLocalPath = "" ;Set path that we want to upload from sFileMask = "*.*" ;File mask for files to upload sRemotePath = "" sConnection = "" ;Connection Directory entry to connect to ftp local chdir sLocalPath ;Change to local directory containing files to upload addfilename sLocalPath sFileMask usermsg "%s" sLocalPath 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 sRemotePath ;If path on FTP server specified ftp remote chdir sRemotePath ;Change to that remote directory endif if findfirst sLocalPath ;If matching files exist in local directory ftp local copyfile $FILENAME ;Copy file to FTP site while $FTPSTATUS ;Loop while file is being copied yield endwhile while findnext ;While more matching files exist ftp local copyfile $FILENAME while $FTPSTATUS yield endwhile endwhile endif endcase endswitch disconnect ;Disconnect from FTP server endproc