---
sourceDocument: Yokohama ServiceNow AI Platform Capabilities
sourceDocumentLink: https://www.servicenow.com/docs/r/yokohama/servicenow-platform

 Release :

    - yokohama

ft:locale :

    - en-US

ft:publication_title :

    - Yokohama ServiceNow AI Platform Capabilities

ft:clusterId :

    - platcap

bundleId :

    - platcap

workflow :

    - Platform


---

# File Write activity

# File Write activity {#ariaid-title1}

* Release version: Yokohama
* 
* Updated January 30, 2025
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 1 minute to read

The File Write activity writes a file on a Linux or UNIX computer.
The source file can be an absolute or relative path from the Directory. If an absolute path
is used, then no value is required in the Directory field.

This activity replaces an SSH activity by the same name available
in releases prior to Istanbul. If you have a workflow created in a previous version that
uses the deprecated activity, your workflow will continue to work normally after upgrading
to Istanbul. However, all new workflows must use the custom version of this activity. This
activity was built with the [SSH activity template](https://www.servicenow.com/docs/Voy9bPRPpW7WXHb_WtSf9w#t_CreateAnSSHActivity "Create an activity that extracts data from a target host that uses the SSH network protocol."), which gives workflow administrators the ability to store
input and output variables in the [databus](https://www.servicenow.com/docs/PrNTwrqX9mIH_QHC_03Elg#t_ReuseDataInTheActivityDesigner "The Data tab in the Workflow Editor lists all custom activities used in the current workflow that produce data and displays that data for reuse in other custom activities.").

## Input variables

{#r_FileWriteActivity__table_d3s_qvz_zp__entry__2}

| Field | Description |
|-|-|
| hostname | Hostname or IP address of destination server for SSH activity. |
| directory | Name of the working (target) directory. |
| file | Name of the file to be written. |
| behavior | Select one of the following: * overwrite: Creates the file if it does not exist and overwrites the file if it does exist. * append: Creates the file if it does not exist and appends the new content to an existing file. * create only: Creates the file if it does not exist and fails if the file does exist. {#r_FileWriteActivity__ul_zhg_yvz_zp} |
| contents | What to write or append (depending on the behavior) to the file |
[Table 1. File Write input variables]

{#r_FileWriteActivity__table_d3s_qvz_zp}

## Output variables

{#r_FileWriteActivity__table_l4m_qkk_pw__entry__2}

| Variable | Description |
|-|-|
| return_code | Indicates whether or not the file write operation was successful. |
| error_message | Message that indicates if an error has occurred. Any value other than 0 indicates a failure. |
[Table 2. File Write output variables]

{#r_FileWriteActivity__table_l4m_qkk_pw}

## Conditions

{#r_FileWriteActivity__table_msz_skk_pw__entry__2}

| Condition | Description |
|-|-|
| Success | The activity wrote a file in the target directory. |
| Failure | The activity failed to write a file in the target directory. |
[Table 3. File Write conditions]

{#r_FileWriteActivity__table_msz_skk_pw}

