This tutorial will implement a JSS process trigger which automatically moves a file from one Path to another Path.
Open the CompleteFTP Manager and select the Events tab. In the Process Triggers panel click on the Add button to add a new event.
Choose the Upload file event.
Check the "Trigger on success" box, then choose the JSS script and enter the script shown below:
try {
var file = system.getFile(event.virtualPath);
file.moveTo("/home/user2");
} catch (e) {
throw "Error while uploading file.";
}
This script will move myfile.txt from its current path (in this case is /home/user1) to /home/user2.
The process trigger should now look like this:
Now your new JSS process trigger is ready to use. Let's check it using Filezilla. If you're new to Filezilla, please check the 'how to use Filezilla' Guide here.
Open Filezilla and connect to the server as 'user1'.
Upload a file to server, it will be upload to /home/user1, then our process trigger is triggered and move the file to /home/user2
Now log into the server, with the 'user2' which was used in the second path.
The file myfile.txt should be moved there: