Example: Using a Command in an Event Rule to Copy Files

If you want to copy EFT's files to another location based on the date (for example, 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 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. 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\).

  3. 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:\ProgramData\Globalscape\admin\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.

  4. Create a Folder Monitor Event Rule.

  5. Add the Condition If File Change equal to operation, and then click operation to change it to added.

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

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

  8. Click OK to close the Command Configuration dialog box, and then click Apply to save the Rule on EFT.

The Rule is now defined to copy log files from the monitored folder (C:\ProgramData\Globalscape\admin\Logs) to the new location (C:\Temp\). (Note that they are copied, not moved.)

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

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