Sample scripts are provided as-is with no warranty of fitness for a particular purpose. These scripts are solely intended to demonstrate techniques for accomplishing common tasks. Additional script logic and error-handling may need to be added to achieve the desired results in your specific environment.
move_remote_files.s
The FTP protocol does not offer a simple way to move files between directories on a remote FTP server. Many FTP servers, however, do support renaming files. You can use this rename functionality to move a file by including the path of the destination in the new file name (for example, renaming "myfile.txt" to "new_directory/myfile.txt").
The most serious limitation of this approach is that it will not work with wildcards -- you must specify each file you want to move by name.
Fortunately, Robo-FTP offers a simple way to work around this limitation.
This sample script iterates through all the files in the remote "source" directory and moves all .mp3 files to the "destination" directory.
1 FTPLOGON "ftp.mysite.com"
2 IFERROR RETURN
3 :top_of_loop
4 GETSITEFILE "*.mp3"
5 IFERROR RETURN $ERROR_SUCCESS
6 SET new_filename = "../destination/directory/" + %sitefile
7 FTPRENAME %sitefile new_filename
8 IFERROR RETURN
9 GOTO top_of_loop