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 (just the /d with no date), 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 to copy files, 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 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 Execute Command dialog box appears.

    db_executecommand_xcopy.gif

  5. In the Choose an existing or create a new one box, click the XCopy Command that you defined in step 1.

  6. In the Working directory box, type the path or click the folder icon  to specify the folder in which the script or custom command executable resides (C:\windows\system32\).

  7. In the 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


    The parameters tell the xcopy command to copy all .log files in the EFT\Logs directory to C:\Temp. The parameter /d (with no date) copies all source files that are newer than destination files.

  8. Click OK to close the Command Configuration dialog box, then click Apply to save the Rule on EFT 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.)

illust_xcopyrule.gif

You could also add an E-mail Notification Action to let you know when the Command is executed.

icon_info.gif

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