PALATINELABSDocsENES

Pages

↑↓ to moveEnter to openEsc to close

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.

Jump to actions

Packages

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

Careful

Paths and lists

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 IDName in editorType; defaultUse
isSizeSizeBooleandefault falsetrue turns on the size filter.
sizeValuesizeValueSizeComparisondefault AtleastAtleast⁠: the size or more. Atmost⁠: the size or less. Exact⁠: less than one byte apart.
sizeSize (KB)Numberdefault 0The size in KB (1 KB = 1024 bytes). 2 is 2048 bytes.
isDateDateBooleandefault falsetrue turns on the date filter.
dateValuedateValueDateFielddefault CreatedCreated⁠: the creation time. Modified⁠: the last time the file was written.
dateRangeValuedateRangeValueDateRangedefault DaysDays⁠: in the last N days. Between⁠: between two dates. On⁠: on one date. Before⁠: before a date.
daysDaysNumberdefault 0For Days⁠: whole days back from now. The limit is included.
startDateStart date (MM/dd/yy)Stringdefault ""For Between⁠: month/day/year, for example 10/01/26 or 10/01/2026⁠. The time is ignored.
endDateEnd date (MM/dd/yy)Stringdefault ""For Between⁠: the end date, for example 10/15/26⁠, in the same form as startDate⁠.
isEndDateIncludedInclude start and end datesBooleandefault falseFor Between⁠: true includes both end dates; false leaves out both.
onDateDate (MM/dd/yy)Stringdefault ""For On⁠: the date, for example 10/15/26⁠. Any time that day matches.
beforeDateDate (MM/dd/yy)Stringdefault ""For Before⁠: the date, for example 10/15/26⁠, as month/day/year.
isBeforeDateIncludedIncluding dateBooleandefault falseFor Before⁠: true includes that date; false only earlier dates.

File date

Field IDName in editorType; defaultUse
dateValueDateDateFielddefault CreatedCreated⁠: 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 IDName in editorType; defaultUse
sourceFileFile variable or value to be assignedStringdefault ""requiredPath text or a File variable, such as $invoice$⁠. The file is not read.

Outputs

OutputName in editorType and use
resultAssign the input toAny⁠. 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.

Back to actions

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 IDName in editorType; defaultUse
directoryPathDirectory pathStringdefault ""requiredThe folder, for example samples⁠.
filenameFilenameStringdefault ""requiredThe wanted file name without a folder, for example invoice.txt⁠.
incrementBeforeExtensionIncrement before extensionBooleandefault falsetrue⁠: invoice.txt becomes invoice_1.txt when taken. false⁠: it becomes invoice.txt_1⁠. The number goes up until no file has that path.

Outputs

OutputName in editorType and use
resultAssign available file path toAny⁠. 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.

Back to actions

Combine to file path (fileCombinePath)

Join a base folder and path parts in order.

Inputs

Field IDName in editorType; defaultUse
basePathBase pathStringdefault ""requiredThe base folder, for example samples⁠. A relative path starts in the Run folder.
pathSegmentsPath segmentsListdefault []requiredThe 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

OutputName in editorType and use
resultAssign combined path toAny⁠. 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.

Back to actions

Copy Desktop file (fileCopyFiles)

Copy local files chosen by path or wildcard.

Inputs

Field IDName in editorType; defaultUse
sourceFilePathSource fileStringdefault ""requiredA file path, or a wildcard in the last part, such as samples/*.txt⁠. A wildcard searches only that folder, not subfolders.
destinationPathDestination file/folderStringdefault ""requiredA file name or folder. To make sure it is a folder, end it with a separator, such as samples/copies/⁠. An existing folder, or more than one source file, also means a folder.
isOverwriteOverwrite existing filesBooleandefault falsetrue replaces an existing target. With false⁠, an existing target fails.
isParallelCopy multiple files simultaneously for improved performanceBooleandefault falsetrue 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.

Back to actions

Create (fileCreateFile)

Create an empty file and its missing parent folders.

Inputs

Field IDName in editorType; defaultUse
filePathFileStringdefault ""requiredThe file to create, for example samples/new.txt⁠.
isOverwriteOverwrite an existing fileBooleandefault falsetrue 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.

Back to actions

Create symbolic link (fileCreateFileShortcut)

Create a symbolic link to a file.

Inputs

Field IDName in editorType; defaultUse
sourceFilePathTarget locationStringdefault ""requiredThe file to link to, for example samples/target.txt⁠.
targetFolderSymbolic link locationStringdefault ""requiredThe folder for the link, for example samples/links⁠. 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.

Back to actions

Create shortcut (fileCreateShortcut)

Create a Windows shortcut (.lnk) to a file.

Inputs

Field IDName in editorType; defaultUse
sourceFilePathTarget locationStringdefault ""requiredThe file the shortcut opens, for example samples/target.txt⁠.
targetFolderShortcut locationStringdefault ""requiredThe folder for the shortcut, for example samples/links⁠. 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.

Back to actions

Delete (fileDeleteFiles)

Delete local files for good. Try the wildcard on test files first.

Inputs

Field IDName in editorType; defaultUse
filePathFileStringdefault ""requiredA file path, or a wildcard in the last part, such as samples/disposable/*.txt⁠. Only that folder is searched.
isParallelDeleteDelete multiple files simultaneously for improved performanceBooleandefault falsetrue 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.

Back to actions

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 IDName in editorType; defaultUse
sourceControl Room fileStringdefault ""requiredThe 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.
destinationTarget file pathStringdefault ""requiredThe file to write on the Device, for example samples/copied-data.csv⁠. Parent folders are created.
overwriteOverwrite existing fileBooleandefault falsetrue 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.

Back to actions

Get file extension (fileGetExtension)

Get the last extension of a path, without the dot.

Inputs

Field IDName in editorType; defaultUse
filePathFileStringdefault ""requiredThe path text, for example samples/invoice.final.csv⁠.

Outputs

OutputName in editorType and use
resultAssign file extension toString. 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.

Back to actions

Get name (fileGetName)

Get the file name with its extension from a path.

Inputs

Field IDName in editorType; defaultUse
sourceFileSource fileStringdefault ""requiredPath text or a File variable, such as $invoice$⁠.

Outputs

OutputName in editorType and use
resultSave the outcome to a variableString. 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.

Back to actions

Get file name without extension (fileGetNameWithoutExtension)

Get the file name without its last extension from a path.

Inputs

Field IDName in editorType; defaultUse
filePathFileStringdefault ""requiredThe path text, for example samples/invoice.final.csv⁠.

Outputs

OutputName in editorType and use
resultAssign file name toString. 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.

Back to actions

Get path (fileGetPath)

Turn path text into a full path on the Device.

Inputs

Field IDName in editorType; defaultUse
sourceFileSource fileStringdefault ""requiredPath text or a File variable, such as $invoice$⁠.

Outputs

OutputName in editorType and use
resultSave the outcome to a variableString. 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.

Back to actions

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 IDName in editorType; defaultUse
filePathFile pathStringdefault ""requiredThe file to read, for example samples/greeting.txt⁠.
charsetNameCharacter SetCharsetdefault UTF_8The file encoding. Other choices: ISO_8859_1⁠, US_ASCII⁠, UTF_16⁠, UTF_16LE⁠, UTF_16BE⁠, UTF_32⁠, UTF_32LE⁠, UTF_32BE⁠. A byte-order mark can identify the encoding.
trimLeadingSpacesTrim leading spacesBooleandefault falsetrue removes spaces, tabs and new lines at the start of the whole text.
trimTrailingSpacesTrim trailing spacesBooleandefault falsetrue removes them at the end of the whole text.

Outputs

OutputName in editorType and use
resultAssign file content toString. 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.

Back to actions

Open (fileOpenFile)

Open the file in its default app.

Inputs

Field IDName in editorType; defaultUse
filePathFileStringdefault ""requiredThe file to open, for example samples/readme.txt⁠.

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.

Back to actions

Print (filePrintFile)

Send one file to the printer if it passes the filters.

Inputs

Field IDName in editorType; defaultUse
filePathFileStringdefault ""requiredThe file to print, for example samples/print-test.txt⁠.

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.

Back to actions

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 IDName in editorType; defaultUse
folderPathFolderStringdefault ""requiredThe folder, for example samples/reports⁠.
filterTypeFile typeFilterModedefault StringValueStringValue uses filterExtensions⁠; RegexValue uses regexFilter⁠. An empty filter matches every file name.
filterExtensionsfilterExtensionsStringdefault ""For StringValue⁠: file name patterns separated by semicolons, for example *.txt;*.csv⁠. Case does not matter. A bare txt is a name pattern, not an extension.
regexFilterregexFilterStringdefault ""For RegexValue⁠: a .NET regular expression for the file name only, for example ^invoice_[0-9]+[.]pdf$⁠. Case matters. Each test stops after five seconds.
includeSubFolderInclude subfoldersBooleandefault falsetrue 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.

Back to actions

Rename (fileRenameFiles)

Rename files in the same folder. An existing name is never replaced.

Inputs

Field IDName in editorType; defaultUse
filePathFileStringdefault ""requiredA file path, or a wildcard in the last part, such as samples/disposable/*.txt⁠. Only that folder is searched.
newFileNameNew file nameStringdefault ""requiredThe 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.

Back to actions

Get sanitized filename (fileSanitizedName)

Replace characters that are not allowed in a file name. Check the result before you use it.

Inputs

Field IDName in editorType; defaultUse
fileNameFilenameStringdefault ""requiredThe name to clean, for example ?invoice:*draft?⁠. Windows rules decide which characters are not allowed.
replacementCharInputReplacement characterStringdefault _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

OutputName in editorType and use
resultAssign sanitized filename toString. 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.

Back to actions

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 IDName in editorType; defaultUse
filePathFile pathStringdefault ""requiredThe file to check, for example samples/dated.txt⁠.
startStart dateDatetimedefault not setrequiredA Datetime variable or ISO 8601 text, for example 2026-10-01T00:00:00+00:00⁠. Included.
endEnd dateDatetimedefault not setrequiredA Datetime variable or ISO 8601 text, for example 2026-10-15T23:59:59+00:00⁠. 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.

Back to conditions

File date on, before or after (fileDateCompare)

Check a file's date against a date. It does not wait.

Inputs

Field IDName in editorType; defaultUse
filePathFile pathStringdefault ""requiredThe file to check, for example samples/dated.txt⁠.
compareComparisonDateComparedefault ONON compares only the date. BEFORE and AFTER compare the full date and time and do not include the same moment.
valueDate valueDatetimedefault not setrequiredA Datetime variable or ISO 8601 text, for example 2026-10-15T12:00:00+00:00⁠.

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.

Back to conditions

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 IDName in editorType; defaultUse
filePathFile pathStringdefault ""requiredThe file to check, for example samples/recent.txt⁠.
amountAmountNumberdefault 0requiredHow many units back from now, for example 24⁠. Use 0 or more. The limit is included. There is no upper limit at now.
unitUnitTimeUnitdefault DAYSThe 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.

Back to conditions

File exists (fileExists)

Check that a file exists. It can wait for the file to appear. A folder is not a file.

Inputs

Field IDName in editorType; defaultUse
sourceFilePathFile pathStringdefault ""requiredThe file to check, for example samples/present.txt⁠.
waitTimeoutWait for this condition (seconds)Numberdefault 0The 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.

Back to conditions

File has extension (fileHasExtension)

Check the extension in a path against a list. The file need not exist. It does not wait.

Inputs

Field IDName in editorType; defaultUse
sourceFilePathFile pathStringdefault ""requiredThe path text, for example samples/REPORT.TXT⁠.
operatorOperatorSetOperatordefault IN_SETIN_SET⁠: true when the extension is in extensions⁠. NOT_IN_SET⁠: the opposite.
extensionsTarget valueListdefault []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.

Back to conditions

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 IDName in editorType; defaultUse
sourceFilePathFile pathStringdefault ""requiredThe path to check, for example samples/absent.txt⁠.
waitTimeoutWait for this condition (seconds)Numberdefault 0The 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.

Back to conditions

File size (fileSize)

Compare the size of a file with a size in KB. It can wait for a match.

Inputs

Field IDName in editorType; defaultUse
sourceFilePathFile pathStringdefault ""requiredThe file to check, for example samples/block.bin⁠.
operatorOperatorSizeOperatordefault LTLT (<), LTE (≤), EQ (=), GTE (≥), GT (>) or NEQ (≠). EQ means less than one byte apart; NEQ means at least one byte apart.
fileSizeSize(KB)Numberdefault 0The size in KB (1 KB = 1024 bytes). Fractions work; 2 is 2048 bytes.
waitTimeoutWait for this condition (seconds)Numberdefault 0The 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.

Back to conditions

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 IDName in editorType; defaultUse
sourceFilePathFile pathStringdefault ""requiredThe file to check, for example samples/editable.txt⁠.
waitTimeSecondsWait for this condition (seconds)Numberdefault 0The 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.

Back to conditions