PRODUCTS > VSHELL > SOLUTIONS GUIDE > AUTOMATICALLY MOVE FILES
Send us a question or comment

I'd like to configure vshelld to automatically move customer-uploaded files to another directory, server or mainframe.

When using SFTP to upload files, you can configure vshelld triggers to automatically move those files to another directory or machine when the upload has successfully completed. One way of doing this is to use a combination of the vshelld SFTPUploadCommand configuration option and either the VShell® vcp or the UNIX rcp command-line utility.

In the vshelld_config file, add SFTPUploadCommand to the options listed. The format of the option is as follows:

SFTPUploadCommand executable <param1> <paramN>

To automatically move the file you just uploaded to a directory on the mainframe, use the following example entry:

vcp -auth publickey -i /home/%U/keys/id_dsa myprog.c %U@myhost:myprogdir/

or you could use:

rcp myprog.c %U@myhost:myprogdir/

The variable $U will be replaced with the username of the user that uploaded the file. Other variables that are available include:

  • $P The path of the file that the user just uploaded.
  • $I The IP address of the machine that just uploaded the file.
  • $T The time that the upload was completed.

You can also move files after upload by configuring the SFTPUploadCommand to run a shell script operation.

For further information on the SFTPUploadCommand and its variables, refer to the vshelld_config (5) man page.

Return to Solutions page