|
Integrating pre and post transfer commands into transfer using FASTCopy
Question:
I need to integrate FASTCopy into my production environment. How can I execute scripts / batch files on the local and remote systems prior to and after a file transfer?
Answer:
The following example will illustrate how to use pre/ post command execution.
You must ensure that the user issuing the command (or the -controller_user if the command is being issued through -batch mode) has execute permissions on the local commands and that the remote user (as specified with the -user qualifier) has execute permissions on the remote node.
Example of the usage of local and remote pre and post transfer commands:
fcopy E:\temp\*.* \\localhost\E:\temp\*.* -user=administrator -password=SOMEPASS -replace -report=detailed -local_pre_command=E:\batch\local_pre_command.bat -local_pre_param=\"param1 param2\" -local_pre_log_file=E:\logs\local_pre_log.txt -local_command=E:\batch\local_post_command.bat -local_param=\"param1 param2\" -local_log_file=E:\logs\local_post_log.txt -remote_pre_command=E:\batch\remote_pre_command.bat -remote_pre_param=\"param1 param2\" -remote_pre_log_file=E:\logs\remote_pre_log.txt -remote_command=E:\batch\remote_post_command.bat -remote_param=\"param1 param2\" -remote_log_file=E:\logs\remote_post_log.txt
You may also pass the following variables to all "parameter" qualifiers:
%s
Source file name of the last file that was transferred.
%t
Target file name of the last file that was transferred.
%f
Last file that was transferred - with local param, this is translated to the local file name.
%1
Converts the succeeding filename to the of the system on which the local_command or remote_command is executed,
rather than being translated on the local machine. This is a very useful modifier during cross-platform operations.
For example:
fcopy E:\temp\a.a \\localhost\E:\temp\b.b -user=administrator -password=SOMEPASS -replace -report=detailed -local_pre_command=E:\batch\local_pre_command.bat -local_pre_param=\"%s %t\"
The batch file echos the following:
echo "E:\temp\a.a and E:\temp\b.b were passed as parameters" 1>E:\batch\local_post_command.txt
Related Topics:
WINDOWS
UNIX
Back to FAQ Index
|