DeleteFile
Summary
The DeleteFile
command deletes one or more files and directories from the Connect SFTP server file system.
Syntax
DeleteFile([FilePath=<path to file>] [, Directory=<directory>] [, Filter=<wildcard filter>] [, Regex=<regular expression>] [, Recursive= true | false ]) |
Parameters
Parameter | Description |
---|---|
FilePath | (Optional) String value or expression containing the full Unix-style path name and source file name to delete. If no path is given, the root SFTP directory is assumed. FilePath allows you to delete a directory instead of a file, but the given directory must be empty (unless the Recursive parameter is set to true).
The |
Directory | (Optional) String value or expression with a directory name or directory path when deleting more than one file. Format is Unix-style. Use with Filter and Regex parameters limit the file names to move and are used in lieu of a filename in FilePath. |
Filter | (Optional) String value containing wildcard search expressions to specify source files to delete. Restricts the command to only those files and directories matching the filter expression. |
Regex | (Optional) Use when you require more complicated search patterns. A string value containnig a Java regular expression. |
Recursive | (Optional) Default is false. When true, the command will recursively delete all files and directories found under the given Directory parameter. Ensure you really want to recursively delete files and directories. There is no unod command. |
Details
Connect is integrated with Xactly’s SFTP server, connectftp.xactlycorp.com. Connect’s file commands can read and write files and manipulate directory structures located on the SFTP file system. An SFTP account is not required to use these functions. However, one is required to access the file system via SFTP clients. Contact Xactly Customer Support to setup an SFTP account if your business does not already have one.
Delete operations are case sensitive.
If the FilePath
parameter specifies a full file path, the single file is deleted. If the Directory
parameter is specified, the following occurs:
- When
Recursive=true
, all files and subdirectories in the directory are deleted - When the
Recursive=false
or the parameter is not specified, the directory is deleted only if it is empty
If either the Filter
or Regex
parameter is specified, only files matching the specified expression are deleted from the location indicated by the Directory
parameter.
The result of the DeleteFile
function is a status result set indicating the success or failure of each attempted file/directory delete.
Examples
call DeleteFile(FilePath='/tmp/foo.csv');
call DeleteFile(Directory='/tmp', Filter='*.csv');
call DeleteFile(FilePath='/archive', Recursive=true);