ftp automation

ScriptFTP

The professional tool to automate FTP, SFTP, FTPS and schedule FTP batch jobs

The forum is now read only. Please, go to the the main ScriptFTP website if you need help.
Need help writing a script? Have any question about ScriptFTP?
Hi, can someone guide me how to write the script to move files that has been downloaded/uploaded into a different folder automatically? Thank you.
Hi Morgan,

In the case you want to download and move the remote files once downloaded see the following example:
Code: Select all# Get the remote file listing, store it in $list $result=GETLIST($list,REMOTE_FILES,"*.txt") # If GETLIST failed stop the script IF($result!="OK") STOP END IF # For each file in $list... FOREACH $item IN $list # Download the file $result=GETFILE($item) # If the file has been successfully downloaded     # move it. If not stop the script. IF($result=="OK") # Note that moving remote files is not always supported         # by the FTP server. See:         # http://www.scriptftp.com/reference.php?go=topic133 RENAMEFILE($item,"/newremotedir/".$item) ELSE STOP END IF END FOREACH

In the case you want to upload files and move the files locally once uploaded the script es pretty similar. You have to retrieve the local file list, use PUTFILE to upload each one and use EXEC to move the local files this way:
Code: Select allEXEC("move ".$item." C:\newdirectory\".$item)
Awesome!! Thank you so much for the solution. Great tool & excellent support.