The sftp task allows you to transfer files from and to a SSH2 server. Also, the SSH2 server should support SFtp subsystem. Not all SSH2 servers support SFtp.
Select the SFtp profile for the SFtp server, you need to connect to. You should have previously created a SFtp profile, using the SFtp Profiles menu item.
Use 'Get' to transfer files from the server to your local system. Use 'Put' to transfer files from your local system to the server. Use 'Delete' to delete files from the server.
This is the most difficult parameter to enter correctly. Execute privilege is required for the remote directory, for all SFtp functions. Read privilege is required for SFtp Get. Write privilege is required, for the SFtp Put function, and for the SFtp Delete function. Note that the path is case sensitive for Unix SFtp servers. If you are transferring files from the Default SFTP login directory, you can leave this field blank.
Enter the full pathname of the local directory, where you need to put files, or get files.
Enter the filename filter for the files you wish to copy using the following wildcard rules. This field also supports dynamic variables. Using dynamic variables, you can select a file based on current date/time.
Folder Path Filter
Leave this field blank if you want all folders to be processed. If you need specific folders to be processed, then enter the folder name or path, using the following wildcard rules. If a folder passes the filter, then all its subfolders will also pass the filter.
Simple Example: Folder = c:\test , subfolders = john, john\old, sam, sam\old, joe, joe\old
Folder path filter = john . john and john\old are processed
Folder path filter = jo . john, john\old, joe, joe\old are processed
Folder path filter = old . sam\old, john\old, joe\old are processed
Folder path filter = test . all files in c:\test and its sub folders are processed
Folder path filter = john\old. only john\old is processed.
Folder path filter = c:\test\john . john and john\old are processed
The rename is done using regular expression. First the filename field entry is compared against the actual filename using regular expression Find method. If a match is found, then the Filename field pattern entered is replaced with the entry in the Rename Filename field. If this field is left blank, then the original filename is maintained.
Append date/time To filename
You can choose to append either the date, or the date and time, or custom code. If your filename has an extension, the date and time, is appended before the extension. This feature is useful for archive purposes.
Backup to Local Directory
Enter the full pathname of the local directory, where you need to backup files. Please note that the Backup to local directory option does not support subdirectories. All files will be placed in the backup directory, without creating new subfolders in it.
Backup to Remote Directory
Enter the full pathname of the remote directory, where you need to backup files. Please note that the Backup to remote directory option does not support subdirectories. All files will be placed in the backup directory, without creating new subfolders in it.
If you select this option, the file is first transferred to the local (get), or remote (put) folders entered. This folder acts as a staging folder. After the Ftp transfer is complete, the file is then moved, to the final destination folder. This option is useful to prevent processes from working on files, while the Ftp transfer is in progress. In the staging field, you should enter the full pathname of the final destination directory. Please note that the staging option does not support subdirectories. All files will be placed in the final destination directory, without creating new subfolders in it.
The umask has be entered in 4-digit octal format. The umask command is used to set the permissions of all files that are put onto the server. Leave this field blank, to use the default Sftp server permissions, for the transferred files. The Umask is the reverse of the normal file permissions, i.e. 0777^umask = permissions.
0077 = -rwx------ (all permissions for user, no permissions for group and world)
0000 = -rwxrwxrwx (all permissions for user, group and world)
0022 = -rwrxr-xr-x (all permissions for user, read+execute permissions for group and world)
0033 = -rwxr--r-- (all permissions for user, read permission for group and world)
0011 = -rwxrw-rw- (all permissions for user, read+write permissions for group and world)
Delete Source file
You can choose to delete the source file, after a successful transfer. If the SFtp transfer fails, the source file will not be deleted.
Transfer with temporary extension
The file is transferred with a temporary extension, and then renamed to the desired name, after the transfer is complete. This is useful, if you have automated scripts/programs, which continuously work on files, with certain extensions. This option ensures that the automated script, will not work on a partially transferred file.
You can choose to log the transfer into the Ftp Log.
Transfer Modified files
If you choose this option, files are transferred only if the source file is newer than the target file.
Transfer Modified files using Ftp Log
If you choose this option, files are transferred only if the source file date is newer than the source file date entry in the Ftp Log. For this option to work correctly, you should also enable the 'Log Transfer' option. If the source file path is not found in the Ftp log, then the file is always transferred.
Place files in new subdirectory
If you select "None", no new subdirectory is created within the Target Directory.
If you select Date, a new subdirectory based on the date is created within the Target Directory. All files are placed in this directory.
If you select Date, a new subdirectory based on date and time is created within the Target Directory. All files are placed in this directory.
This option sets the transfer mode for current operations. The valid modes are:
BINARY - Files are transferred in binary mode and no processing of text files is performed (default mode).
ASCII/TEXT - For servers supporting version 4+ of the SFTP protocol files are transferred in text mode. For earlier protocol versions, the files are transferred in binary mode, but the client performs processing of text. If files are written to the remote server, the client ensures that the line endings conform to the remote EOL. The EOL mode is set using the setRemoteEOL setting below. For files retrieved from the server, the EOL policy is based upon System policy as defined by the "line.seperator" system property.
Set Remote EOL
When connected to servers running SFTP version 3 (or less) the remote EOL type needs to be explicitly set because there is no reliable way for the client to determine the type of EOL for text files. In versions 4+ a mechanism is provided and this setting is overridden.
Valid values for this method are EOL_CRLF (default), EOL_CR, and EOL_LF.