DeleteFile
Deletes a specified file from the remote SFTP server. This is useful for removing outdated or unneeded files from a given directory.
Deleting Files
SFTP allows only a small subset of columns to be used in the EXEC query. These columns can typically be used with only = comparison.
For example:
EXECUTE DeleteFile RemoteFile = '/home/test/CDataTest/SPTest/TestFile.txt'
To delete all files inside a path:
EXECUTE DeleteFile RemotePath = '/home/test/'
To delete all files in parent and subfolders:
EXECUTE DeleteFile RemotePath = '/home/test', IncludeSubFolders = 'true'
To delete files using a pattern:
EXECUTE DeleteFile RemotePath = '/home/test', RemoteFile = '*.txt'
Input
| Name | Type | Required | Description |
| RemoteFile | String | False | The full path and name of the file on the FTP/SFTP server to be deleted. |
| RemotePath | String | False | The remote folder path to delete from. If the IncludeSubFolders parameter is true, files within all subfolders of this path will also be deleted. |
| IncludeSubFolders | Boolean | False | Specifies whether subfolders within the remote path should also be deleted (true) or preserved (false).
The default value is false. |
Result Set Columns
| Name | Type | Description |
| Success | String | Indicates whether the delete operation completed successfully (true) or unsuccessfully (false). |
| FileName | String | The name of the file that was deleted from the FTP/SFTP server. |