File v2

The File Node reads, writes, copies, moves, renames, deletes, inspects, lists, and listens for files and folders on the local file system of a Local Runtime.

Revision History

0.0.0.1 - Initial release.
0.0.0.3 - Project restructure.
0.0.0.5 - SupportedCluster update.
0.0.0.10 - Node name correction.
0.0.0.20 - Added Listen method.
0.0.0.22 - Corrected Listener rename tracking so reused file names are detected.
0.0.0.23 - Updated the Node icon.
0.1.0.1 - Added configurable file locking to the Read method.
0.1.1.0 - Added List method.
0.1.1.1 - Fixed template methods.
0.1.1.8 - Added Rename, CreateDirectory and ListDirectory methods, folder support for Copy, Move and Delete, and the IgnoreMissing option for Delete. Move now fails when the source and destination are the same file.

Setup Notes

This Node runs against the local file system of the Local Runtime where the Workflow executes.

Make sure the Local Runtime service account has the required access to the paths that the Workflow will read, write, move, delete, or watch.

Methods

The File Node exposes local file and folder operations, filtered file listings, directory browsing, and a listener trigger for file changes.

Read

Reads a local file and returns its content as a stream. You can choose whether the Node permits compatible access from other processes while the stream is being consumed.

Parameter Type Description
Path String Path of the file to read.
LockType Enum Controls access while the file is being read. Non-Exclusive permits compatible readers, writers, and file replacement. Exclusive prevents other processes from opening the file. The default is Non-Exclusive.
Return Type Description
Content Stream Stream containing the file content.

Write

Writes content to a local file and can replace an existing file when requested.

Parameter Type Description
Path String Path of the file to write.
Content Stream Content stream to write to the file.
OverwriteExisting Boolean When true, an existing file is replaced. When false, the method fails if the file already exists. The default is true.
Return Type Description
None None This method does not emit output values.

Copy

Copies a local file or folder tree into a destination folder, preserving its name. With OverwriteExisting enabled, matching folders merge and matching files are replaced.

Parameter Type Description
Path String Path of the file or folder to copy.
Destination String Destination folder into which the file or folder is copied.
OverwriteExisting Boolean When true, an existing file at the destination is replaced. The default is true.
Return Type Description
None None This method does not emit output values.

Move

Moves a local file or folder tree into a destination folder, preserving its name. With OverwriteExisting enabled, matching folders merge and matching files are replaced.

Parameter Type Description
Path String Path of the file or folder to move.
Destination String Destination folder into which the file or folder is moved.
OverwriteExisting Boolean When true, an existing file at the destination is replaced. The default is true.
Return Type Description
None None This method does not emit output values.

Rename

Renames a local file or folder within its current parent folder. The method fails if an entry with the new name already exists; existing entries are never replaced.

Parameter Type Description
Path String Path of the file or folder to rename.
NewName String New name for the entry. Supply a single name without a folder path, separators, . or ...
Return Type Description
None None This method does not emit output values.

Delete

Deletes a local file, or a folder and all of its contents. Links are removed without deleting their targets.

Parameter Type Description
Path String Path of the file or folder to delete.
IgnoreMissing Boolean When true, a missing path succeeds without change. When false, a missing path fails. Other errors always fail. The default is false.
Return Type Description
None None This method does not emit output values.

CreateDirectory

Creates a local folder and any missing parent folders. An existing folder is left unchanged, but the method fails if a file exists at the path.

Parameter Type Description
Path String Path of the folder to create.
Return Type Description
None None This method does not emit output values.

Info

Retrieves metadata for a local file or folder.

Parameter Type Description
Path String Path of the file or folder to inspect.
Return Type Description
Metadata Object Metadata object containing ObjectType, ObjectPermission, SizeInBytes, CreationTime, LastWriteTime, and FullPath.

List

Lists files in a local directory using a wildcard filter and bounded subdirectory traversal.

Parameter Type Description
DirectoryPath String Path of the directory containing the files to list.
Filter String Wildcard expression matched against file names. The default is *.
FolderDepthLimit Integer Maximum number of subdirectory levels to traverse, from 0 to 50. Set 0 to list only the supplied directory.
ReturnFullPath Boolean When true, each item contains the full path. When false, each item contains only the file name. The default is true.
Return Type Description
Files Array Matching files sorted by path. Each item includes FilePath, the one-based CurrentRow, and TotalRows.

The Node captures the complete listing before returning the output stream, so path, permission, and provider failures surface before downstream enumeration begins. No matches return zero rows. Only files are returned; duplicate full paths are removed before row numbers are assigned. Later file changes are not reflected in the snapshot.

ListDirectory

Lists the immediate files, folders and links in a local folder, with their available metadata. Unlike List, this method includes folders and links, and does not traverse subfolders.

Parameter Type Description
DirectoryPath String Path of the folder whose immediate children should be returned.
Return Type Description
Response Array Entries sorted by full path. Each item includes Name, FullPath, ObjectType (File, Directory, Link or Unknown), SizeInBytes (null for folders, links and unavailable sizes), and LastWriteTime in UTC (null when unavailable).

Hidden entries are included, and folder links are identified without traversing their targets. A missing path, or a path to a file, fails the method.

Listen

Watches a local file or folder and fires when a matching file is created, modified, or renamed.

Parameter Type Description
Path String Folder or file path to watch for changes.
Mask String File mask used when watching a folder, such as *.txt or *.*.
PollInterval Integer Time in seconds between checks when polling is used. Set 0 to use event-based monitoring.
FolderDepthLimit Integer Subdirectory depth to evaluate. 0 means only the supplied directory level is watched.
FindMatchesOnStart Boolean When true, matching files are emitted immediately when the Node starts.
Return Type Description
Files Array Array of file-change events. Each item includes ChangedFilePath.

Usage Notes

Use exact local paths that are valid on the machine running the Local Runtime.

When OverwriteExisting is true, Write creates a missing parent folder. The Copy and Move methods also create a missing Destination folder.

When Copy or Move receives a folder, the folder is placed inside Destination with its nested folders, empty folders, hidden files and file contents. For example, copying C:\in\reports to C:\archive produces C:\archive\reports. With OverwriteExisting disabled, an existing destination entry fails before anything is written. A conflict between a file and a folder of the same name always fails. The source and destination must not overlap, and folder transfers reject symbolic links, junctions and special entries. Permissions, ownership and timestamps are not copied.

A folder Move copies all contents before removing the source, so it works across volumes but is not an atomic rename. A failure during the copy leaves the source intact but can leave partial content at the destination. Avoid changing the source or destination while a folder transfer is running.

Delete fails when the path does not exist unless IgnoreMissing is enabled.

The Read method releases its file handle when the content reaches the end of the stream or the stream is disposed. A Non-Exclusive read cannot override an exclusive lock held by another process.

The List method captures a snapshot before it returns the matching files. Use Filter and FolderDepthLimit to limit the listing.

For folder listeners, use Mask and FolderDepthLimit to keep the watch scope predictable and to avoid reacting to unrelated files.