Filesystem Activities
Version: 1.0.6 · ID: zoan-packages-fs · Author: Zoan Software
The Files (filesystem) package works with files and folders: read and write text files, copy, move, delete, check whether something exists and list a folder’s contents. It is a support package found in almost every automation — to organize downloads, produce output files, move processed documents or read configuration data.
File paths
Section titled “File paths”Almost every activity takes a path. You can give it in two ways:
- Absolute path:
C:\reports\output.txtorC:/reports/output.txt. In expressions, the backslash is taken literally:"C:\reports\output.txt"(to end a text with a backslash, write it twice:"C:\reports\\" + name). See Windows paths. Network paths (\\server\share\file.txt) also work if the account the robot runs under has access. - Project file with
asset(...): for files that travel inside your package (templates, sample data), useasset("data/input.txt"). It resolves the right path on whatever machine runs it. See asset().
Avoid relative paths (output.txt, data\output.txt): they are resolved against the robot’s working folder, which depends on where it starts. Since version 1.0.6, writing, appending, copying or moving with just a file name no longer fails, but a full path makes it clear where the file ends up.
Destination folders
Section titled “Destination folders”Write File, Append to File, Copy File and Move File create the destination folder (and any intermediate ones) if it does not exist: you don’t need a Create Directory first.
Overwriting (overwrite)
Section titled “Overwriting (overwrite)”Watch the defaults, which are not the same in every activity:
| Activity | Default overwrite |
|---|---|
| Write File | true — replaces the existing file |
| Copy File / Move File | false — fails if the destination exists |
Encoding (encoding)
Section titled “Encoding (encoding)”Read File, Write File and Append to File accept an encoding by name. Default "utf-8".
| Value | When to use it |
|---|---|
utf-8 | Default. When writing, the file starts with the UTF-8 BOM, which Excel and Notepad recognize. |
iso-8859-1 (or latin1) | Files from legacy Windows systems whose accented characters look wrong as UTF-8. |
utf-16 (or unicode), utf-16BE, utf-32 | Unicode files with 2 or 4 bytes per character. |
us-ascii | ASCII characters only; anything else becomes ?. |
When reading, if the file starts with a BOM (UTF-8, UTF-16 or UTF-32), the BOM wins over the given encoding. Other code-page names (such as windows-1252) may not be available and make the activity fail with 'windows-1252' is not a supported encoding name…: use iso-8859-1 instead.
System errors
Section titled “System errors”Besides each activity’s own messages, a file operation can fail with an operating-system error (these messages may appear in English or in the Windows language). The most common:
| Message | Cause and fix |
|---|---|
The process cannot access the file '…' because it is being used by another process. | Another program has the file open (typically an open Excel workbook). Close it first, or retry with Retry and a delay. |
Access to the path '…' is denied. | The robot’s account has no permission on the file or folder, or the file is read-only. |
Could not find a part of the path '…'. | A folder in the path does not exist (for example, a disconnected network drive). |
Activities
Section titled “Activities”Read and write text
Section titled “Read and write text”| Activity | Type | Output | What it does |
|---|---|---|---|
| Read File | read-file | string | Reads the content of a text file |
| Write File | write-file | string | Writes text to a file (creates or replaces it) |
| Append to File | append-file | string | Appends text to the end of a file |
File operations
Section titled “File operations”| Activity | Type | Output | What it does |
|---|---|---|---|
| File Exists | file-exists | bool | Does the file exist? |
| Copy File | copy-file | string | Copies a file to another path |
| Move File | move-file | string | Moves or renames a file |
| Delete File | delete-file | — | Deletes a file |
Folders
Section titled “Folders”| Activity | Type | Output | What it does |
|---|---|---|---|
| Create Directory | create-directory | string | Creates a folder (and any missing ones in the path) |
| List Files | list-files | List | Lists the files/folders in a directory |
A typical flow
Section titled “A typical flow”Process each downloaded file and archive it:
List Files path = "C:/downloads" pattern = "*.xlsx" → output: files
For Each items = files itemVariable = path └─ activities: ... process the file ... Move File source = path destination = pathJoin("C:/processed", fileName(path))Next steps
Section titled “Next steps”- Read File / Write File — the most used.
- List Files — walk through a folder.
- Expressions › Files and paths —
pathJoin,fileName,asset…