Moving Files After They Are Uploaded to Serv-U - KB Article #2165Related Articles -- 2160
I want to move a file somewhere else after it is uploaded to Serv-U.
To move a file to a different location, you can create a File Moved event at the server, domain, group, and user level.
Perform the following steps to create this event.
- If you want to create a File Moved event on the server or domain level, navigate to Server/Domain Details > Events in the Management Console. If you want to create this event on the group or user level, select the appropriate user or group under Users/Groups, click Edit, and then click Events.
- Click Add.
- Select File Uploaded from the Event Type list.
- Provide an event name and an optional description.
- Under Event Actions, select Execute Command from the Action list.
- In Executable Path, browse to the file that contains the command you want to execute.
- Specify the following Command Line Parameters. Make sure that you include the quotation marks
to handle potential spaces in the path names.
- "DestinationPath", which is the location where you want to move the file
- Specify the number of seconds to wait after starting the executable path in the Completion
Wait Time field.
Note: Configuring a value for Completion Wait Time will block Serv-U while it waits.
- Click Save.
The following examples provide sample commands you can adapt to your needs.
REM This moves a file from one location to another.
REM %1 - the full source path of the original file
REM %2 - the path to move the file to. This may be a directory if the
REM original filename is to be preserved, but it may also contain a new filename to use.
move %1 %2
# This moves a file from one location to another.
# $1 - the full source path of the original file
# $2 - the path to move the file to. This may be a directory if the original
# filename is to be preserved, but it may also contain a new filename to use.
mv $1 $2
- On Linux, you have to make sure that your script has execute permissions on it.
- If you run Serv-U before version 15.1.0 on Linux, make sure that your command line parameters are passed to the script correctly. For more information, please refer to the KB article about Passing command line parameters to external applications.