Skip to content

File Operations

The File perations node performs a range of file and directory operations including reading, writing, copying, moving, deleting files, and listing files or directories.

Purpose

Use this node to:

✅ Manage files and directories dynamically within workflows.
✅ Read or write text or binary files.
✅ Move, copy, rename, delete, or check existence of files.
✅ List files or directories based on patterns for batch processing.

Inputs

Field LabelInput TypeDescription
File PathTextThe path to the file or directory to perform operations on. Required for all operations.
OperationTextThe operation to perform. Supported values are: Rename, Copy, Move, Delete, Exists, ReadText, WriteText, AppendText, ReadBytes, WriteBytes, ListFiles, ListDirectories, CreateDirectory, GetAttributes.
New Name (conditional)TextRequired for Rename. The new file name.
Destination Path (conditional)TextRequired for Copy and Move. The destination folder path.
Overwrite (conditional)BooleanRequired for Copy, WriteText, and WriteBytes. Whether to overwrite existing files.
Content (conditional)TextRequired for WriteText and AppendText. The content to write or append.
Bytes (conditional)Byte[]Required for WriteBytes. The byte array to write to the file.
Search Pattern (conditional)TextRequired for ListFiles and ListDirectories. The search pattern to use.
Recursive (conditional)BooleanRequired for ListFiles and ListDirectories. Whether to search recursively.

Outputs

Output VariableDescription
ResultThe result of the operation. The type varies based on operation:
Rename, Copy, Move, WriteText, WriteBytes, AppendText, CreateDirectory: returns the resulting file or directory path.
Delete: returns true.
Exists: returns true or false.
ReadText: returns file content as string.
ReadBytes: returns file content as byte array.
ListFiles, ListDirectories: returns a list of file or directory paths.
GetAttributes: returns file attributes as string.

Functionality

This node:

  1. Validates required inputs based on the operation type.
  2. Performs the specified file or directory operation:
    • Uses .NET File and Directory methods for execution.
  3. Returns the result in the Result output variable.
  4. Removes processed input keys from taskParameters.data for cleanliness.

Example Use Case

✅ Rename a file after download for compliance with naming conventions.
✅ Copy files to a processing folder with overwrite control.
✅ Check if a configuration file exists before workflow execution.
✅ Read a file’s contents for parsing and data extraction.
✅ List all PDF files in a folder for batch processing.

Task Success Criteria

  • Success: Operation completes successfully, returning the expected result.
  • Failure: If inputs are missing, invalid, or an operation fails (e.g. file not found), the task returns a descriptive error message indicating the failure point.

Notes

  • The Operation input determines which other inputs are required.
  • Ensure paths provided are valid and accessible to the workflow execution environment.
  • For WriteBytes, the input byte array must be of type byte[].

Tentech 2024