Using a Command in an Event Rule to Copy Files

If you want to copy EFT Server's files to another location based on the date (e.g., all log files created on a specified date), you can create a custom command that points to the Windows XCopy command. The executable is (by default) in c:\windows\system32\xcopy.exe. Numerous switches are available for this command. (You can see all of the options by typing xcopy /? at a command prompt.) You must type the source path and the destination path. You can add a switch, /d:mm-dd-yy, to copy files that were changed on or after a specified date. If no date is provided, it copies all source files that are newer than existing destination files. That is, it will not copy a file with the same name/same date or same name/older date.

To define an Event Rule, assuming that EFT Server has permissions to access the files, you can create a Folder Monitor Rule and specify that if the Condition "If File Change does equal to added" exists, then execute the Command to xcopy the newer files to the destination location.

To define an Event Rule to copy log files

  1. Create a custom command to execute the Windows XCopy command. The executable is (by default) in c:\windows\system32\xcopy.exe.

  2. Create a Folder Monitor or File Uploaded Event Rule.

  3. Add the Condition If File Change equal to operation, then click operation to change it to added. The Condition should now read If File Change does equal to added.

  4. Add the Execute command in folder Action to the Rule, then click select. The Custom Command dialog box appears.

  5. In the Select command box, click the XCopy Command that you defined in step 1.

  6. In the Specify command parameters box, type the source folder (the location of the log files), the destination folder (the location to which to copy the files), and any other xcopy parameters you need. For example, type:

    "C:\Program Files\GlobalSCAPE\EFT\Logs\*.log" "C:\Temp\" /d


    These parameters tell the xcopy command to copy all .log files in the EFT\Logs directory to C:\Temp. The parameter /d:mm-dd-yyyy copies files changed on or after the specified date. If no date is given, it copies all source files that are newer than destination files.  

  7. In the Specify command working folder box, type the path or click the open icon  to specify the folder in which the script or custom command executable resides (C:\windows\system32\).

  8. Click OK to close the Custom Command dialog box, then click Apply to save the Rule on the Server.

The Rule is now defined to copy log files from the monitored folder (C:\Program Files\GlobalSCAPE\EFT\Logs) to the new location. (Note that they are copied, not moved.)

You could also add an e-mail Notification Action to let you know when the copy was executed.

Always use caution when giving program access to your system32 directory (especially an FTP server).