Remove File or Directory activity

reference brazil Updated Sep 10, 2026 1 min read r_RemoveFileOrDirectoryActivity.md
Raw file servicenow.com

The Remove File or Directory activity removes a file or a directory on an SFTP server, including subdirectories, when configured.

Input variables

Variable Description
sourceHost Name or IP address of the server containing the files you want to remove.
sourcePort Port number to use to communicate with the target server. The default port number is 22.
sourceFilePath Full path to the file or directory to remove. To remove multiple files or directories using a single activity, enter a semicolon-separated list of paths in this field.
isDirectory True/false variable that determines if the specified file path is a directory. The default value for this variable is false.
includeSubfolders True/false variable that determines if the given directory and all of its subfolders should be removed. The default value for this variable is false. If the value for this field is false, then the activity can only remove an empty directory. This field appears when the isDirectory checkbox is selected.
sourceCredentialTag Specific Credential aliases for Orchestration activities this activity must use to run SSH commands on the host.

Output variables

Variable

Description

errorMessage

The executionResult.errorMessages from the Activity designer parsing sources. If this variable is not null, the operation has failed.

result

Either success or failure.

deletionResults

The deletionResults array contains these attributes:- fullPath: Full path to the file or directory targeted.

  • status: Either succeeded or failed.
  • reason: Text message describing the cause of a failure.
## Conditions
Condition Description
Success The activity succeeded in removing the file or directory specified.
Failure The activity failed to remove the file or directory specified.

Parent Topic:SFTP File Transfer activity pack

Search documentation
Search document titles and file paths on the brazil branch