SFTP Predefined Operations

The following predefined SFTP operations are available:

cd

Changes the working directory on the remote SFTP server.

Input parameters
Name Description
path (String) Absolute or relative path of the directory that you want as the working directory on the remote SFTP server.
Output parameters
Name Description
returnCode (String) Standard SFTP protocol return code.
returnMsg (String) Text message describing the return code.

chgrp

Changes the group ownership of one or more remote files.

Input parameters
Name Description
groupId (String) Numeric group identifier of the group to which you want to transfer ownership of the remote files.
path (String) Absolute or relative path of the remote files.
Output parameters
Name Description
returnCode (String) Standard SFTP protocol return code.
returnMsg (String) Text message describing the return code.

chmod

Changes permissions of one or more remote files.

Input parameters
Name Description
mode (String) The permission mode to apply to the remote file (for example, 777).
path (String) Absolute or relative path of the remote files.
Output parameters
Name Description
returnCode (String) Standard SFTP protocol return code.
returnMsg (String) Text message describing the return code.

chown

Changes the owning user of one or more remote files.

Input parameters
Name Description
uid (String) Numeric user ID of the new owning user of the file.
path (String) Absolute or relative path of the remote files.
Output parameters
Name Description
returnCode (String) Standard SFTP protocol return code.
returnMsg (String) Text message describing the return code.

get

Retrieves a file from a remote SFTP server.

Input parameters
Name Description
remoteFile (String) Absolute or relative path of the remote file.
Output parameters
Name Description
returnCode (String) Standard SFTP protocol return code.
returnMsg (String) Text message describing the return code.
contentStream (Object) A java.io.InputStream object.

ls

Retrieves the remote directory listing of the specified path. If path is not specified, the ls service retrieves the file listing of the current remote directory. The ls service also retrieves additional details such as permissions and ownership information.

Input parameters
Name Description
path (String) Optional. Absolute or relative path of the remote directory. If no path is specified, the ls service retrieves the directory listing of the current remote directory. You can use the wildcard characters asterisk (*) and question mark (?) after the last slash mark (/) to view all remote directories that match the specified path.
Output parameters
Name Description
returnCode (String) Standard SFTP protocol return code.
returnMsg (String) Text message describing the return code.
dirList (Document) List of directories matching the pattern specified in the path parameter. This document has the following parameters:
fileName (String) Specifies the name of the remote file.
fileSize (String) Specifies the size of the remote file.
permissions (String) Specifies the access permission of the file (read, write, or execute).
lastAccessTime (String) Specifies the time when the file was last accessed.
lastModifiedTime (String) Specifies the time when the file was last modified.
uid (String) Specifies the user ID of the file owner.
gid (String) Specifies the group ID associated with the file.
longName (String) Specifies the long name of the ls entry. It contains all the parameters that are separated by a space.

mkdir

Creates a new remote directory.

Input parameters
Name Description
path (String) Absolute or relative path of the remote directory where you want to create a new directory.
Output parameters
Name Description
returnCode (String) Standard SFTP protocol return code.
returnMsg (String) Text message describing the return code.

put

Transfers a file to a remote SFTP server.

Input parameters
Name Description
contentStream (java.io.InputStream) Data to be transferred to the remote file.
remoteFile (String) Absolute or relative path of the remote file to which the contentStream would be written based on the mode.
mode (String) Optional. Specifies how the local file is to be transferred to the remote SFTP server. Set to:
overwrite Overwrite the contents of the remote file with the contents of the contentStream. This is the default.
append Append the entire contents of the contentStream to the remote file.
resume Resume writing the contents of the contentStream to the remote file from the point the writing was stopped during previous SFTP sessions.
Output parameters
Name Description
returnCode (String) Standard SFTP protocol return code.
returnMsg (String) Text message describing the return code.

pwd

Displays the remote working directory in the SFTP server.

Input parameters

None.

Output parameters
Name Description
returnCode (String) Standard SFTP protocol return code.
returnMsg (String) Text message describing the return code.
path (String) Absolute or relative path of the working directory on the remote SFTP server.

rename

Renames a file or directory on a remote SFTP server.

Input parameters
Name Description
oldPath (String) Fully qualified name of the file you want to rename (for example, temp/oldname.txt).
newPath (String) New fully qualified name for the file (for example, temp/newname.txt).
Output parameters
Name Description
returnCode (String) Standard SFTP protocol return code.
returnMsg (String) Text message describing the return code.

rm

Deletes one or more remote files on the SFTP server.

Input parameters
Name Description
path (String) Absolute or relative path of the file you want to delete.
Output parameters
Name Description
returnCode (String) Standard SFTP protocol return code.
returnMsg (String) Text message describing the return code.

rmdir

Deletes one or more remote directories on the SFTP server.

Input parameters
Name Description
path (String) Absolute or relative path of the directory you want to delete.
Output parameters
Name Description
returnCode (String) Standard SFTP protocol return code.
returnMsg (String) Text message describing the return code.
Usage note

The remote directories that you want to delete must be empty.

symlink

Creates a symbolic link between the old path and the new path of a file.

Input parameters
Name Description
oldPath (String) Old path of the file for which you want to create a symbolic link.
newPath (String) New path of the file to which the symbolic link should point.
Output parameters
Name Description
returnCode (String) Standard SFTP protocol return code.
returnMsg (String) Text message describing the return code.