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

  1. In the administration interface, connect to EFT and click the Server tab.

  2. 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.

  3. 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.

  4. In the Rule Builder, in the Monitor folder Event, click [select]. The Monitor Folder dialog box appears.

  5. 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.

  6. 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.)

  7. In the If File Name Condition, click the [path mask] link. The Choose File Names dialog box appears.

  8. 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

  9. Next, you must specify the Action to occur when this Event is triggered. In the right pane, in the Actions list, click Protocol: Upload. The Action is added to the Rule Builder.

  10. Click one of the undefined parameters (for example, '%FS.PATH%'). The Offload Action Wizard appears.

  11. 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 ProtocolUploadAction for other protocol types.)

  12. Click Next. The Source File Path page appears.

  13. In the Source path box, type %FS.PATH% (or you can leave it blank).

  14. 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.)

  15. Click Next. The Destination File Path page appears.

  16. 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.

  17. 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.

WARNING: 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).