Example: Moving an Uploaded File Based on Filename
Suppose every Friday the manager of Engineering uploads a status report named status<date>.doc to EFT. You want the manager of Marketing to have access to that file, but not to any other files in the Engineering manager's folder. The example below describes how to create an Event Rule so that when a file with "status" in the name is uploaded to EFT, EFT makes a copy of it in another user's folder.
To move an uploaded file based on the filename
-
In the administration interface, connect to EFT and click the Server tab.
-
On the Server tab, expand the Site you want to configure, and then click Event Rules. In the right pane, click New. The Create New Event Rule dialog box appears.
-
In the Create New Rule dialog box, click Folder Monitor, and then click Create. The new Rule appears in the Rule Builder and includes the If File Change Condition.
-
In the Rule Builder, in the Monitor folder Event, click [select]. The Monitor Folder dialog box appears.
-
Define the Monitor Folder trigger. If necessary, refer to Monitoring Folders for details of creating a Monitor Folder Rule. Note that if you create a Monitor Folder Rule to monitor a folder that is already being monitored by another Monitor Folder Rule, a warning message appears because the two Monitor Folder Rules can cause a race condition that may result in errors or undesirable results. If that is the case, you can add the new Conditions and Actions to the existing Rule.
-
Click the If File Change Condition in the Rule Builder to select it, then in the Conditions list, double-click the If File Name Condition. The If File Name Condition appears in the Rule Builder on the same line as the If File Change Condition. (See the screen shot in step 9 below.)
-
In the If File Name Condition, click the [path mask] link. The Choose File Names dialog box appears.
-
In the Specify comparison value box, specify the file name and/or a wildcard mask, click Add, and then click OK. For example, to filter for a Word document whose filename starts with "status, " type: status?.doc
-
Next, you must specify the Action to occur when this Event is triggered. In the right pane, in the Actions list, click Copy/Move (push) file to host. The Action is added to the Rule Builder.
-
Click one of the undefined parameters (for example, '%FS.PATH%'). The Offload Action Wizard appears.
-
In the Offload method box, specify a protocol type for the connection. For this example, we will choose Local (Local Files or LAN). (Refer to Copy/Move (push) File to Host Action for other protocol types.)
-
Click Next. The Source File Path page appears.
-
In the Source path box, type %FS.PATH% (or you can leave it blank).
-
If you want to Delete source file after it has been offloaded, select the check box. (If the file is marked read-only, it will not be deleted.)
-
Click Next. The Destination File Path page appears.
-
In the Destination path box, click the folder icon and specify the location in which to save the offloaded file. (No validation is performed.) In this example, we specified a user's folder.
-
Click Finish then click Apply to save the changes on EFT. (You could also add other Actions, such as email notifications.)
Now when a user uploads a file called status?.doc, EFT will move it to the destination folder specified.
If you are copying or moving the file to another location, and the file upload is a regularly occurring Event with a file of the same name, in the Offload Action wizard, you can add the variables %EVENT.DATESTAMP% and/or %EVENT.TIMESTAMP% to the path so that the date (YYYYMMDD) and/or time (HHMMSS) are added to the filename when it is moved/copied.
Do not use %EVENT.TIME%, because the colon (for example, 28 Aug 07 10:01:56) makes it invalid for file naming.
For example, type:
C:\Documents and Settings\administrator\My Documents\upload\%EVENT.DATESTAMP%_%EVENT.TIMESTAMP%_%FS.FILE_NAME%
With this path and variables, when a file is uploaded to the monitored folder, the file is moved to \My Documents\upload and the date and time are prepended to the filename (for example, 20080422_101212_mydailyprogress.doc).