FTPLOGON ;; set output_directory and archive_directory ;; NOTE: need to use the full path here SET output_directory = "C:\Program Files\Robo-FTP\output" SET archive_directory = "C:\Program Files\Robo-FTP\output-archive" ;; Set the working directory to the "output" directory WORKINGDIR output_directory :loop ;; Get a file from the working directory ;; NOTE: if successful this will set the "%nextfile" internal ;; script variable to the file name found GETNEXTFILE "*" IFERROR RETURN $ERROR_SUCCESS ;; set file_found to "%nextfile" SET file_found = %nextfile ;; file was found, send it SENDFILE file_found IFERROR RETURN ;; rename the file with the date ;; do string manipulation to "break" up file name found to ;; get the base name from the extension ;; NOTE: this sample is assuming a 3 character extension ;; will be used SET base_name = file_found ;; set 4 characters on the right to extension and split ;; apart remaining SETRIGHT extension = base_name "4" /split ;; set archive_name to base_name + %date + extension SET archive_name = base_name & %date & extension ;; rename file_found to archive_name RENAME file_found archive_name ;; set the archive_path to archive_directory + "\" + archive_name SET archive_path = archive_directory & "\" & archive_name ;; move the file to archive_path MOVE archive_name archive_path ;; loop GOTO loop