File package guide
Use File to manage local files, read path text and evaluate file conditions.
Version 2.14.0. Installed versions can differ. Examples are illustrative and not tested.
Prerequisites
This package is for Windows. Run it with an account that can read the sources and write the targets. A relative path starts in the Run folder. A full path is used as given and can point outside that folder. Try the examples on test files in a samples folder.
Needs
- Open and Print need a signed-in desktop and an app for the file type. Print also needs a printer.
- Create shortcut needs Windows Script Host.
- Create symbolic link needs Windows permission, for example Developer Mode.
Careful
- Delete removes files for good, not to the Recycle Bin.
- Create with overwrite empties an existing file.
- An error part way can leave earlier changes in place.
Paths and lists
- Assign, Get name, Get file extension, Get file name without extension, Get path and Combine to file path only work on the path text. The file need not exist.
- Copy, Create and the link actions create missing parent folders.
- Use a List variable for lists, such as
$parts$or$allowed$. A JSON array, or text separated by commas or new lines, also works.
Shared fields
A field is optional unless its table says required. An action that uses a shared table says so under its Inputs.
Size and date filters
Copy Desktop file, Delete, Print, Print multiple files and Rename check each file with these filters. A file must pass every filter that is on. The size fields are used only when isSize is on, and the date fields only when isDate is on. Dates use the Device's local time.
| Field ID | Name in editor | Type; default | Use |
|---|---|---|---|
is | Size | Booleandefault false | true turns on the size filter. |
size | size | Sizedefault Atleast | Atleast: the size or more. Atmost: the size or less. Exact: less than one byte apart. |
size | Size (KB) | Numberdefault 0 | The size in KB (1 KB = 1024 bytes). 2 is 2048 bytes. |
is | Date | Booleandefault false | true turns on the date filter. |
date | date | Datedefault Created | Created: the creation time. Modified: the last time the file was written. |
date | date | Datedefault Days | Days: in the last N days. Between: between two dates. On: on one date. Before: before a date. |
days | Days | Numberdefault 0 | For Days: whole days back from now. The limit is included. |
start | Start date (MM/ | Stringdefault "" | For Between: month/day/year, for example 10/ or 10/. The time is ignored. |
end | End date (MM/ | Stringdefault "" | For Between: the end date, for example 10/, in the same form as start. |
is | Include start and end dates | Booleandefault false | For Between: true includes both end dates; false leaves out both. |
on | Date (MM/ | Stringdefault "" | For On: the date, for example 10/. Any time that day matches. |
before | Date (MM/ | Stringdefault "" | For Before: the date, for example 10/, as month/day/year. |
is | Including date | Booleandefault false | For Before: true includes that date; false only earlier dates. |
File date
| Field ID | Name in editor | Type; default | Use |
|---|---|---|---|
date | Date | Datedefault Created | Created: the creation time. Modified: the last time the file was written. Use the Device's local time and offset. |
Actions
Assign (fileAssign)
Put path text in a File variable for later steps.
Inputs
| Field ID | Name in editor | Type; default | Use |
|---|---|---|---|
source | File variable or value to be assigned | Stringdefault ""required | Path text or a File variable, such as $invoice$. The file is not read. |
Outputs
| Output | Name in editor | Type and use |
|---|---|---|
result | Assign the input to | Any. Bind it to a File variable. Its value is the path text, not the file contents. |
Example
Set sourceFile=samples/invoice.txt. Bind result to File variable invoice.
Expected result
$invoice$ holds samples/invoice.txt, even if no such file exists.
Get Available File (fileAvailableName)
Find a file name that is not used yet, such as invoice_1.txt. Nothing is created or reserved. A folder at that path is not checked.
Inputs
| Field ID | Name in editor | Type; default | Use |
|---|---|---|---|
directory | Directory path | Stringdefault ""required | The folder, for example samples. |
filename | Filename | Stringdefault ""required | The wanted file name without a folder, for example invoice.txt. |
increment | Increment before extension | Booleandefault false | true: invoice.txt becomes invoice_ when taken. false: it becomes invoice.txt_. The number goes up until no file has that path. |
Outputs
| Output | Name in editor | Type and use |
|---|---|---|
result | Assign available file path to | Any. Bind it to a File variable. Its value is the path text. |
Example
Create samples/invoice.txt, and make sure samples/invoice_1.txt does not exist. Set directoryPath=samples, filename=invoice.txt and incrementBeforeExtension=true. Bind result to nextFile.
Expected result
nextFile holds the full path ending in samples/invoice_1.txt. No file is written. If that name is taken too, the number goes up.
Combine to file path (fileCombinePath)
Join a base folder and path parts in order.
Inputs
| Field ID | Name in editor | Type; default | Use |
|---|---|---|---|
base | Base path | Stringdefault ""required | The base folder, for example samples. A relative path starts in the Run folder. |
path | Path segments | Listdefault []required | The path parts in order, such as a List variable parts with archive and invoice.txt. A part that starts at a drive or root replaces the parts before it. |
Outputs
| Output | Name in editor | Type and use |
|---|---|---|
result | Assign combined path to | Any. Bind it to a File variable. Its value is the path text. |
Example
Create List parts with archive and invoice.txt. Set basePath=samples and pathSegments=$parts$. Bind result to combined.
Expected result
combined holds the full path ending in samples/archive/invoice.txt, with the system's path separators. No folder or file is created.
Copy Desktop file (fileCopyFiles)
Copy local files chosen by path or wildcard.
Inputs
| Field ID | Name in editor | Type; default | Use |
|---|---|---|---|
source | Source file | Stringdefault ""required | A file path, or a wildcard in the last part, such as samples/*.txt. A wildcard searches only that folder, not subfolders. |
destination | Destination file/ | Stringdefault ""required | A file name or folder. To make sure it is a folder, end it with a separator, such as samples/. An existing folder, or more than one source file, also means a folder. |
is | Overwrite existing files | Booleandefault false | true replaces an existing target. With false, an existing target fails. |
is | Copy multiple files simultaneously for improved performance | Booleandefault false | true copies files at the same time. false copies them one by one. |
Also uses the size and date filters.
Outputs
No outputs.
Example
Create samples/small.txt with 1 byte and samples/large.txt with 4096 bytes. Set sourceFilePath=samples/*.txt, destinationPath=samples/copies/, isSize=true, sizeValue=Atleast, size=2, isOverwrite=false and isDate=false.
Expected result
Only samples/copies/large.txt is copied, with the same bytes. A wildcard with no match copies nothing. A missing file path can fail.
Create (fileCreateFile)
Create an empty file and its missing parent folders.
Inputs
| Field ID | Name in editor | Type; default | Use |
|---|---|---|---|
file | File | Stringdefault ""required | The file to create, for example samples/. |
is | Overwrite an existing file | Booleandefault false | true empties an existing file. false does not replace it. |
Outputs
No outputs.
Example
Set filePath=samples/disposable/new.txt and isOverwrite=false, with no file at that path.
Expected result
An empty new.txt is created. A second run fails. With isOverwrite=true, the old contents are lost.
Create symbolic link (fileCreateFileShortcut)
Create a symbolic link to a file.
Inputs
| Field ID | Name in editor | Type; default | Use |
|---|---|---|---|
source | Target location | Stringdefault ""required | The file to link to, for example samples/. |
target | Symbolic link location | Stringdefault ""required | The folder for the link, for example samples/. It is created if needed. This is not the full link name. |
Outputs
No outputs.
Example
Create samples/target.txt with linked. Set sourceFilePath=samples/target.txt and targetFolder=samples/links, with no samples/links/target.txt.
Expected result
samples/links/target.txt links to the file; reading it gives linked. The file is not copied. Missing permission or an existing link path fails.
Create shortcut (fileCreateShortcut)
Create a Windows shortcut (.lnk) to a file.
Inputs
| Field ID | Name in editor | Type; default | Use |
|---|---|---|---|
source | Target location | Stringdefault ""required | The file the shortcut opens, for example samples/. |
target | Shortcut location | Stringdefault ""required | The folder for the shortcut, for example samples/. It is created if needed. This is not the full shortcut name. |
Outputs
No outputs.
Example
Create samples/target.txt. Set sourceFilePath=samples/target.txt and targetFolder=samples/links.
Expected result
samples/links/target.lnk opens the file, with the file's folder as its working folder. The file is not copied or opened. Without Windows Script Host, the step fails.
Delete (fileDeleteFiles)
Delete local files for good. Try the wildcard on test files first.
Inputs
| Field ID | Name in editor | Type; default | Use |
|---|---|---|---|
file | File | Stringdefault ""required | A file path, or a wildcard in the last part, such as samples/. Only that folder is searched. |
is | Delete multiple files simultaneously for improved performance | Booleandefault false | true deletes files at the same time. false deletes them one by one. |
Also uses the size and date filters.
Outputs
No outputs.
Example
Create samples/disposable/a.txt, b.txt and keep.md. Set filePath=samples/disposable/*.txt, isParallelDelete=false, isSize=false and isDate=false.
Expected result
a.txt and b.txt are deleted, not moved to the Recycle Bin. keep.md stays. Missing files and files the filters reject are skipped. A permission error can leave some files deleted.
Copy Control Room file (fileDownloadTo)
Copy a file that ships with the automation (in its assets folder) to a path on the Device.
Inputs
| Field ID | Name in editor | Type; default | Use |
|---|---|---|---|
source | Control Room file | Stringdefault ""required | The relative path of a file shipped with the automation. The action looks in the Run folder first, then in its assets folder. A full path or a .. part fails. |
destination | Target file path | Stringdefault ""required | The file to write on the Device, for example samples/. Parent folders are created. |
overwrite | Overwrite existing file | Booleandefault false | true replaces an existing file. With false, an existing file fails. |
Outputs
No outputs.
Example
Ship assets/data.csv with a,b in the automation. Set source=data.csv, destination=samples/copied-data.csv and overwrite=false.
Expected result
samples/copied-data.csv holds a,b. A file with the same name in the Run folder wins over assets. A missing source, a path that is not allowed, or an existing destination with overwrite=false fails.
Get file extension (fileGetExtension)
Get the last extension of a path, without the dot.
Inputs
| Field ID | Name in editor | Type; default | Use |
|---|---|---|---|
file | File | Stringdefault ""required | The path text, for example samples/. |
Outputs
| Output | Name in editor | Type and use |
|---|---|---|
result | Assign file extension to | String. The last extension without its dot. |
Example
Set filePath=samples/invoice.final.csv. Bind result to String extension.
Expected result
extension is csv. A path with no extension gives an empty String.
Get name (fileGetName)
Get the file name with its extension from a path.
Inputs
| Field ID | Name in editor | Type; default | Use |
|---|---|---|---|
source | Source file | Stringdefault ""required | Path text or a File variable, such as $invoice$. |
Outputs
| Output | Name in editor | Type and use |
|---|---|---|
result | Save the outcome to a variable | String. The file name with its extension. |
Example
Set sourceFile=samples/invoice.final.csv. Bind result to String name.
Expected result
name is invoice.final.csv. A path that ends with a separator gives an empty name.
Get file name without extension (fileGetNameWithoutExtension)
Get the file name without its last extension from a path.
Inputs
| Field ID | Name in editor | Type; default | Use |
|---|---|---|---|
file | File | Stringdefault ""required | The path text, for example samples/. |
Outputs
| Output | Name in editor | Type and use |
|---|---|---|
result | Assign file name to | String. The file name without the last extension. |
Example
Set filePath=samples/invoice.final.csv. Bind result to String stem.
Expected result
stem is invoice.final. A name without an extension stays the same.
Get path (fileGetPath)
Turn path text into a full path on the Device.
Inputs
| Field ID | Name in editor | Type; default | Use |
|---|---|---|---|
source | Source file | Stringdefault ""required | Path text or a File variable, such as $invoice$. |
Outputs
| Output | Name in editor | Type and use |
|---|---|---|
result | Save the outcome to a variable | String. The full path. |
Example
Set sourceFile=samples/invoice.txt. Bind result to String fullPath.
Expected result
fullPath is the full path of samples/invoice.txt in the Run folder. It is a String, not a File variable. A path with characters that are not allowed can fail.
Get text from file (fileGetText)
Read all the text of a local file. Trimming works on the whole text, not on each line.
Inputs
| Field ID | Name in editor | Type; default | Use |
|---|---|---|---|
file | File path | Stringdefault ""required | The file to read, for example samples/. |
charset | Character Set | Charsetdefault UTF_ | The file encoding. Other choices: ISO_, US_, UTF_, UTF_, UTF_, UTF_, UTF_, UTF_. A byte-order mark can identify the encoding. |
trim | Trim leading spaces | Booleandefault false | true removes spaces, tabs and new lines at the start of the whole text. |
trim | Trim trailing spaces | Booleandefault false | true removes them at the end of the whole text. |
Outputs
| Output | Name in editor | Type and use |
|---|---|---|
result | Assign file content to | String. All the text, after any trimming. |
Example
Create UTF-8 samples/greeting.txt with hello . Set filePath=samples/greeting.txt, charsetName=UTF_8, trimLeadingSpaces=true and trimTrailingSpaces=true. Bind result to greeting.
Expected result
greeting is hello. Without trimming, it is hello . An empty file gives an empty String. A missing file or no read permission fails.
Open (fileOpenFile)
Open the file in its default app.
Inputs
| Field ID | Name in editor | Type; default | Use |
|---|---|---|---|
file | File | Stringdefault ""required | The file to open, for example samples/. |
Outputs
No outputs.
Example
Create samples/readme.txt. Set filePath=samples/readme.txt on a signed-in test desktop.
Expected result
Windows gets a request to open the file in the text app. The step does not wait for the app to close. A missing file, or no app for the file type, fails.
Print (filePrintFile)
Send one file to the printer if it passes the filters.
Inputs
| Field ID | Name in editor | Type; default | Use |
|---|---|---|---|
file | File | Stringdefault ""required | The file to print, for example samples/. |
Also uses the size and date filters.
Outputs
No outputs.
Example
Use a one-page samples/print-test.txt and a test printer. Set filePath=samples/print-test.txt, isSize=false and isDate=false.
Expected result
Windows gets a print request. The step does not confirm the printout or wait for the print queue. A missing file, or a file the filters reject, prints nothing. An error from the print app fails.
Print multiple files (filePrintMultipleFiles)
Print the files in a folder that match a name, size and date, in alphabetical order. Use a test printer.
Inputs
| Field ID | Name in editor | Type; default | Use |
|---|---|---|---|
folder | Folder | Stringdefault ""required | The folder, for example samples/. |
filter | File type | Filterdefault String | String uses filter; Regex uses regex. An empty filter matches every file name. |
filter | filter | Stringdefault "" | For String: file name patterns separated by semicolons, for example *.txt;*.csv. Case does not matter. A bare txt is a name pattern, not an extension. |
regex | regex | Stringdefault "" | For Regex: a .NET regular expression for the file name only, for example ^invoice_[0-9]+[.]pdf$. Case matters. Each test stops after five seconds. |
include | Include subfolders | Booleandefault false | true also searches all subfolders. |
Also uses the size and date filters.
Outputs
No outputs.
Example
Create samples/print/a.txt and b.txt. Set folderPath=samples/print, filterType=StringValue, filterExtensions=*.txt, includeSubFolder=false, isSize=false and isDate=false.
Expected result
Windows gets a print request for a.txt, then for b.txt. A missing folder or no match prints nothing. A print error can come after earlier requests were sent.
Rename (fileRenameFiles)
Rename files in the same folder. An existing name is never replaced.
Inputs
| Field ID | Name in editor | Type; default | Use |
|---|---|---|---|
file | File | Stringdefault ""required | A file path, or a wildcard in the last part, such as samples/. Only that folder is searched. |
new | New file name | Stringdefault ""required | The new file name or pattern. Each * becomes the old name without its extension, so *.bak turns invoice.csv into invoice.bak. No folder separators, full paths, . or ... |
Also uses the size and date filters.
Outputs
No outputs.
Example
Create samples/disposable/invoice.csv with rows. Set filePath=samples/disposable/*.csv, newFileName=*.bak, isSize=false and isDate=false.
Expected result
invoice.csv becomes invoice.bak with the same contents. Missing files and files the filters reject are skipped. A name that is taken fails and can leave some files renamed.
Get sanitized filename (fileSanitizedName)
Replace characters that are not allowed in a file name. Check the result before you use it.
Inputs
| Field ID | Name in editor | Type; default | Use |
|---|---|---|---|
file | Filename | Stringdefault ""required | The name to clean, for example ?invoice:*draft?. Windows rules decide which characters are not allowed. |
replacement | Replacement character | Stringdefault _ | Only the first character is used. Empty, or a character that is not allowed, uses _. Repeated replacements become one and are removed from both ends. |
Outputs
| Output | Name in editor | Type and use |
|---|---|---|
result | Assign sanitized filename to | String. The cleaned name. It can be empty. |
Example
Set fileName=?a:*b? and replacementCharInput=_. Bind result to String cleanName.
Expected result
cleanName is a_b. A name made only of characters that are not allowed can give an empty String. Reserved names, length limits and names already in use are not checked.
Conditions
Each condition returns true or false for an If or Loop step. It has no outputs.
File date between (fileDateBetween)
Check that a file's date and time is between two dates and times, both included. It does not wait.
Inputs
| Field ID | Name in editor | Type; default | Use |
|---|---|---|---|
file | File path | Stringdefault ""required | The file to check, for example samples/. |
start | Start date | Datetimedefault not setrequired | A Datetime variable or ISO 8601 text, for example 2026-10-01. Included. |
end | End date | Datetimedefault not setrequired | A Datetime variable or ISO 8601 text, for example 2026-10-15. Included. Use a value at or after start. |
Also uses the file date field.
Outputs
No outputs.
Example
Create samples/dated.txt last written at 2026-10-10T12:00:00+00:00. Set filePath=samples/dated.txt, dateValue=Modified, start=2026-10-01T00:00:00+00:00 and end=2026-10-15T00:00:00+00:00.
Expected result
true. A missing file, a date outside the range, or start after end gives false.
File date on, before or after (fileDateCompare)
Check a file's date against a date. It does not wait.
Inputs
| Field ID | Name in editor | Type; default | Use |
|---|---|---|---|
file | File path | Stringdefault ""required | The file to check, for example samples/. |
compare | Comparison | Datedefault ON | ON compares only the date. BEFORE and AFTER compare the full date and time and do not include the same moment. |
value | Date value | Datetimedefault not setrequired | A Datetime variable or ISO 8601 text, for example 2026-10-15. |
Also uses the file date field.
Outputs
No outputs.
Example
Create samples/dated.txt last written at 2026-10-10T12:00:00+00:00. Set filePath=samples/dated.txt, dateValue=Modified, compare=BEFORE and value=2026-10-11T00:00:00+00:00.
Expected result
true. A missing file gives false for every comparison. For ON, use the file's date in the Device's local time.
File date within the last (fileDateWithin)
Check that a file's date is in the last N hours, days, minutes or seconds. It reads once and does not wait.
Inputs
| Field ID | Name in editor | Type; default | Use |
|---|---|---|---|
file | File path | Stringdefault ""required | The file to check, for example samples/. |
amount | Amount | Numberdefault 0required | How many units back from now, for example 24. Use 0 or more. The limit is included. There is no upper limit at now. |
unit | Unit | Timedefault DAYS | The unit of amount: DAYS, HOURS, MINUTES or SECONDS. |
Also uses the file date field.
Outputs
No outputs.
Example
Create samples/recent.txt now. Set filePath=samples/recent.txt, dateValue=Modified, amount=1 and unit=HOURS.
Expected result
true while the file was written in the last hour. An older or missing file gives false. A date in the future also gives true.
File exists (fileExists)
Check that a file exists. It can wait for the file to appear. A folder is not a file.
Inputs
| Field ID | Name in editor | Type; default | Use |
|---|---|---|---|
source | File path | Stringdefault ""required | The file to check, for example samples/. |
wait | Wait for this condition (seconds) | Numberdefault 0 | The longest wait in whole seconds. 0 or less checks once. More checks about every 250 ms until true or the time ends. |
Outputs
No outputs.
Example
Create samples/present.txt. Set sourceFilePath=samples/present.txt and waitTimeout=0.
Expected result
true. A missing file gives false after the wait. A file you cannot see because of permissions can also give false.
File has extension (fileHasExtension)
Check the extension in a path against a list. The file need not exist. It does not wait.
Inputs
| Field ID | Name in editor | Type; default | Use |
|---|---|---|---|
source | File path | Stringdefault ""required | The path text, for example samples/. |
operator | Operator | Setdefault IN_ | IN_: true when the extension is in extensions. NOT_: the opposite. |
extensions | Target value | Listdefault [] | A List of extensions, for example txt and csv. A leading dot and outer spaces are removed. Case does not matter. |
Outputs
No outputs.
Example
Create List allowed with txt and csv. Set sourceFilePath=samples/REPORT.TXT, operator=IN_SET and extensions=$allowed$.
Expected result
true, even if the file does not exist. report.md gives false with the same list. With an empty list, IN_SET gives false and NOT_IN_SET gives true.
File does not exist (fileNotExists)
Check that no file exists at a path. It can wait for the file to go. A folder at the path also gives true.
Inputs
| Field ID | Name in editor | Type; default | Use |
|---|---|---|---|
source | File path | Stringdefault ""required | The path to check, for example samples/. |
wait | Wait for this condition (seconds) | Numberdefault 0 | The longest wait in whole seconds. 0 or less checks once. More checks about every 250 ms until true or the time ends. |
Outputs
No outputs.
Example
Make sure samples/absent.txt does not exist. Set sourceFilePath=samples/absent.txt and waitTimeout=0.
Expected result
true. An existing file gives false until it goes or the wait ends. It does not prove that you can write to the path.
File size (fileSize)
Compare the size of a file with a size in KB. It can wait for a match.
Inputs
| Field ID | Name in editor | Type; default | Use |
|---|---|---|---|
source | File path | Stringdefault ""required | The file to check, for example samples/. |
operator | Operator | Sizedefault LT | LT (<), LTE (≤), EQ (=), GTE (≥), GT (>) or NEQ (≠). EQ means less than one byte apart; NEQ means at least one byte apart. |
file | Size(KB) | Numberdefault 0 | The size in KB (1 KB = 1024 bytes). Fractions work; 2 is 2048 bytes. |
wait | Wait for this condition (seconds) | Numberdefault 0 | The longest wait in whole seconds. 0 or less checks once. More checks about every 250 ms until true or the time ends. |
Outputs
No outputs.
Example
Create samples/block.bin with exactly 2048 bytes. Set sourceFilePath=samples/block.bin, operator=EQ, fileSize=2 and waitTimeout=0.
Expected result
true. A 1024-byte file gives false. A missing file gives false, even with NEQ.
File is writable (fileWritable)
Check that no other program has the file open and that you can write it. Nothing is created or changed.
Inputs
| Field ID | Name in editor | Type; default | Use |
|---|---|---|---|
source | File path | Stringdefault ""required | The file to check, for example samples/. |
wait | Wait for this condition (seconds) | Numberdefault 0 | The longest wait in seconds; fractions work. 0 or less checks once. More checks about every 250 ms. |
Outputs
No outputs.
Example
Create samples/editable.txt that no program has open and that the account can read and write. Set sourceFilePath=samples/editable.txt and waitTimeSeconds=0.
Expected result
true. A missing, locked, read-only or inaccessible file gives false after the wait. A program can still lock the file later.