Folder package guide
Use Folder to manage local folders, list files, write ZIP archives and evaluate folder conditions.
Version 2.14.0. Installed versions can differ. Examples are illustrative and not tested.
Prerequisites
This package is for Windows. Use an account that can read sources and write or delete the targets. A relative path starts in the Run folder. A full path is used as given. Try examples on test data in samples. Keep copy destinations and ZIP outputs outside the source folders.
Careful
- Create with overwrite, Delete, and Zip with Delete original files remove data for good.
- An error part way can leave earlier copies, deletions or extracted files in place.
ZIP
- Passwords do not work for creating or opening a ZIP. Leave the password Credential empty.
- A folder's files are stored under its name. Empty folders are not kept.
Needs
- Open needs a signed-in desktop.
- Create shortcut needs Windows Script Host.
- Create symbolic link needs Windows permission.
- Use a List variable of String items for extensions, for example
$allowed$withtxtandcsv.
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 checks each file. Delete and Rename check the size of everything in the folder and the folder's own dates. The size fields are used only when isSize is on, and the date fields only when isDate is on. A file or folder must pass every filter that 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. |
Actions
Get Available Directory (folderAvailableName)
Find a folder name that is not used yet, such as reports_1. Nothing is created or reserved. A file at that path is not checked.
Inputs
| Field ID | Name in editor | Type; default | Use |
|---|---|---|---|
parent | Parent directory path | Stringdefault ""required | Parent folder in which to find a free directory name, e.g. samples. |
directory | Directory name | Stringdefault ""required | Proposed single folder name, e.g. reports. Use no folder path. On conflicts, the action tries reports_, reports_ and so on. |
Outputs
| Output | Editor field | Type and use |
|---|---|---|
result | Assign available directory path to | File value (Any). Bind to a File variable; its value is path text. It does not contain file bytes. |
Example
Create samples/reports and ensure samples/reports_1 is absent. Set parentPath=samples, directoryName=reports; bind result to nextFolder.
Expected result
The File value ends in samples/reports_1 as an absolute path. No folder is created.
Copy (folderCopyFolder)
Copy selected files from a folder and its subfolders into a destination folder. Empty subfolders are skipped.
Inputs
| Field ID | Name in editor | Type; default | Use |
|---|---|---|---|
source | Source folder | Stringdefault ""required | Source folder path, e.g. samples/. Use one folder without wildcards. |
destination | Destination folder | Stringdefault ""required | Parent destination folder. The source folder name is added automatically. samples/ plus source samples/ produces samples/. |
is | Overwrite existing files/ | Booleandefault false | Allow replacement of an existing target. Leave false to receive an error on a conflict. |
Also uses the size and date filters.
Outputs
No outputs.
Example
Prepare samples/reports/a.txt with 1 byte and samples/reports/nested/b.txt with 4096 bytes. Set sourceFolderPath=samples/reports, destinationFolderPath=samples/backup, isOverwrite=false, isSize=true, sizeValue=Atleast, size=2, isDate=false.
Expected result
Only samples/backup/reports/nested/b.txt is copied. A missing source fails. A conflicting target fails unless overwrite is enabled. Keep the destination outside the source folder.
Create (folderCreateFolder)
Create a folder and its missing parents. Overwrite deletes the existing folder and its contents first.
Inputs
| Field ID | Name in editor | Type; default | Use |
|---|---|---|---|
folder | Folder | Stringdefault ""required | Folder path, e.g. samples/. Relative paths use the Run folder. |
is | Overwrite an existing folder | Booleandefault false | true recursively deletes the existing folder and all its contents, then creates an empty folder. This is destructive. false reports an existing folder as an error. |
Outputs
No outputs.
Example
Set folderPath=samples/disposable/new, isOverwrite=false, with no existing folder there.
Expected result
The new folder exists and is empty. A second execution fails. With isOverwrite=true, all previous files and subfolders are permanently deleted first.
Create symbolic link (folderCreateFolderShortcut)
Create a symbolic link to a folder. The target is not copied.
Inputs
| Field ID | Name in editor | Type; default | Use |
|---|---|---|---|
source | Target location | Stringdefault ""required | Source folder path, e.g. samples/. Use one folder without wildcards. |
target | Symbolic link location | Stringdefault ""required | Folder in which to write the link, e.g. samples/. The action creates this folder if needed. This is not the full link filename. |
Outputs
No outputs.
Example
Prepare samples/reports/a.txt. Set sourceFolderPath=samples/reports, targetFolder=samples/links, with no existing samples/links/reports.
Expected result
samples/links/reports links to the original folder. Reading samples/links/reports/a.txt reads the original file. An occupied link path or lack of privilege fails.
Create shortcut (folderCreateShortcut)
Create a Windows shortcut (.lnk) to a folder.
Inputs
| Field ID | Name in editor | Type; default | Use |
|---|---|---|---|
source | Target location | Stringdefault ""required | Source folder path, e.g. samples/. Use one folder without wildcards. |
target | Shortcut location | Stringdefault ""required | Folder in which to write the link, e.g. samples/. The action creates this folder if needed. This is not the full link filename. |
Outputs
No outputs.
Example
Prepare samples/reports. Set sourceFolderPath=samples/reports, targetFolder=samples/links.
Expected result
The action writes samples/links/reports.lnk, using the target folder as its working folder. It does not open or copy the folder. Missing Windows Script Host fails.
Delete (folderDeleteFolder)
Delete a folder and everything in it, for good.
Inputs
| Field ID | Name in editor | Type; default | Use |
|---|---|---|---|
folder | Folder | Stringdefault ""required | Folder path, e.g. samples/. Relative paths use the Run folder. |
Also uses the size and date filters.
Outputs
No outputs.
Example
Prepare disposable samples/disposable/remove/a.txt. Set folderPath=samples/disposable/remove, isSize=false, isDate=false.
Expected result
The folder and all its contents are deleted without the Recycle Bin. A missing or filter-rejected folder is left alone. Permission or lock errors can interrupt deletion.
Get files with extensions (folderFilesWithExtensions)
List files from a folder and, if selected, its subfolders. The order is not fixed.
Inputs
| Field ID | Name in editor | Type; default | Use |
|---|---|---|---|
directory | Directory path | Stringdefault ""required | Folder path, e.g. samples. Relative paths use the Run folder. |
search | Search recursively | Booleandefault false | true searches all subfolders. false searches only the named folder. |
filter | Files to include | Filterdefault ALL | ALL returns every file and ignores extensions. SPECIFIC returns only files whose extension is in the list. An empty list with SPECIFIC returns no files. |
extensions | Extensions | Listdefault [] | List of extension strings, e.g. a List variable with txt and csv. Leading dots and surrounding spaces are removed; matching ignores letter case. |
Outputs
| Output | Editor field | Type and use |
|---|---|---|
result | Assign file paths to | List of File values with absolute paths. Bind to a List variable and process its items with a loop. Order is not guaranteed. |
Example
Prepare samples/list/a.txt, b.csv and sub/c.txt. Prepare List allowed with String txt. Set directoryPath=samples/list, searchRecursively=true, filterType=SPECIFIC, extensions=$allowed$; bind result to found.
Expected result
found contains the absolute File paths for a.txt and sub/c.txt, in unspecified order. No matches returns an empty List. A missing or inaccessible folder fails.
Open (folderOpenFolder)
Open an existing folder in Windows.
Inputs
| Field ID | Name in editor | Type; default | Use |
|---|---|---|---|
folder | Folder | Stringdefault ""required | Folder path, e.g. samples/. Relative paths use the Run folder. |
Outputs
No outputs.
Example
Prepare samples/reports. Set folderPath=samples/reports.
Expected result
Windows is asked to display the folder, normally in File Explorer. The action does not wait for that window to close. A missing folder or Windows error fails.
Get parent folder (folderParent)
Get the folder that holds a path. The path need not exist.
Inputs
| Field ID | Name in editor | Type; default | Use |
|---|---|---|---|
file | File | Stringdefault ""required | Path to the file, e.g. samples/. Relative paths use the Run folder. |
Outputs
| Output | Editor field | Type and use |
|---|---|---|
result | Assign parent folder to | File value (Any). Bind to a File variable; its value is path text. It does not contain file bytes. |
Example
Set filePath=samples/reports/invoice.csv; bind result to parent.
Expected result
parent is a File value whose absolute path ends in samples/reports. For a filesystem root with no containing folder, the result is empty.
Rename (folderRenameFolder)
Rename a folder in the same parent folder.
Inputs
| Field ID | Name in editor | Type; default | Use |
|---|---|---|---|
folder | Folder | Stringdefault ""required | Folder path, e.g. samples/. Relative paths use the Run folder. |
new | New folder name | Stringdefault ""required | New leaf name, e.g. reviewed. The folder stays in the same parent. Paths, separators, . and .. are rejected. |
Also uses the size and date filters.
Outputs
No outputs.
Example
Prepare disposable samples/old/a.txt with kept. Set folderPath=samples/old, newFolderName=reviewed, isSize=false, isDate=false, with no samples/reviewed target.
Expected result
samples/reviewed/a.txt contains kept; samples/old is gone. Missing or filter-rejected source folders are skipped. An occupied destination causes an error.
Unzip (folderUnzipFiles)
Extract an unencrypted ZIP, protecting existing files unless overwrite is enabled.
Inputs
| Field ID | Name in editor | Type; default | Use |
|---|---|---|---|
source | Zip file name with full path | Stringdefault ""required | Existing ZIP filename, e.g. samples/. Password-protected ZIP archives are not supported. |
target | Extract to path | Stringdefault ""required | Folder to receive archive entries, e.g. samples/. It is created if needed. Entry subfolders are preserved. |
is | Replace existing file | Booleandefault false | Allow replacement of an existing target. Leave false to receive an error on a conflict. |
password | Password to access zip file | Credentialdefault empty Credential | Leave the Credential password empty. A nonempty password is rejected: this package cannot create or extract password-protected ZIP archives. The username is not used. |
Outputs
No outputs.
Example
Prepare samples/archive.zip containing docs/a.txt with one. Set sourcePath=samples/archive.zip, targetPath=samples/extracted, isOverwrite=false; leave password empty.
Expected result
samples/extracted/docs/a.txt contains one. The ZIP remains. An existing conflicting file, invalid archive or nonempty password fails; earlier entries can already have been extracted.
Zip (folderZipFiles)
Put files and folders into a ZIP file. Empty folders are skipped. If two files have the same entry name, the first wins. Entries are added in alphabetical name order.
Inputs
| Field ID | Name in editor | Type; default | Use |
|---|---|---|---|
source | Specify file(s)/ | Stringdefault ""required | One or more file paths, folder paths or last-segment wildcards, separated by semicolons, for example samples/. A folder contributes all matching files in the folder and its subfolders under its own name. Missing sources contribute nothing. |
filter | Specify file type(s) to compress | Filterdefault String | String uses filter; Regex uses regex. An empty active filter accepts every filename. |
filter | filter | Stringdefault "" | For String, enter filename wildcard patterns separated by semicolons, e.g. *.txt;*.csv. Matching ignores letter case. A bare txt is a filename pattern, not an extension shortcut. |
regex | regex | Stringdefault "" | For Regex, enter a .NET regular expression applied to the filename only, e.g. ^invoice_[0-9]+[.]pdf$. Matching is case-sensitive and has a five-second timeout per test. |
target | Specify destination filename and location | Stringdefault ""required | Full ZIP output filename, e.g. samples/. Keep it outside all selected source folders and different from all source files. Parent folders are created. |
is | Update only if newer | Booleandefault false | true updates an existing ZIP: it keeps an entry when its ZIP timestamp is at least as new as the source, and replaces older entries. Unrelated entries remain. false deletes any existing target ZIP and creates a new one. |
is | Delete original files | Booleandefault false | true permanently deletes every selected source file after the archive is closed, including files skipped as not newer during an update. It also removes immediate containing folders that become empty, except the job folder. Use disposable sources. |
compression | Compression | Compressiondefault Normal | Normal uses optimal compression. Fast and Superfast both use the fastest compression available from the runtime. |
password | Password protection | Credentialdefault empty Credential | Leave the Credential password empty. A nonempty password is rejected: this package cannot create or extract password-protected ZIP archives. The username is not used. |
Outputs
No outputs.
Example
Prepare disposable samples/docs/a.txt, samples/docs/deep/b.txt and samples/docs/skip.md. Set sourcePath=samples/docs, filterType=StringValue, filterExtensions=*.txt, targetPath=samples/archive.zip, compressionLevel=Fast, isUpdateNewer=false, isDeleteOriginalFiles=false; leave password empty.
Expected result
The ZIP contains docs/a.txt and docs/deep/b.txt; source files remain. Missing sources can produce an empty ZIP. With update disabled, an existing target archive is replaced. Password protection is rejected.
Conditions
Each condition returns true or false for an If or Loop step. It has no outputs.
Folder does not exist (folderDoesNotExists)
Test for no directory, optionally waiting for removal. A file at the path also satisfies the test.
Inputs
| Field ID | Name in editor | Type; default | Use |
|---|---|---|---|
folder | Folder path | Stringdefault ""required | Folder path, e.g. samples/. Relative paths use the Run folder. |
wait | Wait for this condition (seconds) | Numberdefault 0 | Maximum whole seconds: 0 or negative tests once; positive polls about every 250 ms until true or timeout. |
Outputs
No outputs.
Example
Ensure samples/absent-folder is absent. Set folderPath=samples/absent-folder, waitTimeout=0.
Expected result
true. An existing folder is false until it disappears or the wait ends.
Folder exists (folderExists)
Test directory existence, optionally waiting for appearance. A file does not count.
Inputs
| Field ID | Name in editor | Type; default | Use |
|---|---|---|---|
folder | Folder path | Stringdefault ""required | Folder path, e.g. samples/. Relative paths use the Run folder. |
wait | Wait for this condition (seconds) | Numberdefault 0 | Maximum whole seconds: 0 or negative tests once; positive polls about every 250 ms until true or timeout. |
Outputs
No outputs.
Example
Prepare samples/present-folder. Set folderPath=samples/present-folder, waitTimeout=0.
Expected result
true. A missing folder returns false after the optional wait.
Folder has file with extension (folderHasFileWithExtension)
Check if a folder has (or does not have) a file with an extension. It can include subfolders and wait.
Inputs
| Field ID | Name in editor | Type; default | Use |
|---|---|---|---|
directory | Folder path | Stringdefault ""required | Folder path, e.g. samples. Relative paths use the Run folder. |
condition | Condition | Containsdefault CONTAINS | CONTAINS is true when at least one matching file exists. NOTCONTAINS is true when none exists, including when the folder is missing. |
extension | File extension | Stringdefault ""required | Single extension, e.g. txt or .txt. The search pattern is *. plus the extension after spaces and leading dots are removed. Filename matching follows the operating system. |
search | Search recursively | Booleandefault false | true searches all subfolders. false searches only the named folder. |
wait | Wait for this condition (seconds) | Numberdefault 0 | Maximum wait in seconds; fractions are accepted. 0 or a negative value tests once. A positive value polls about every 250 ms. |
Outputs
No outputs.
Example
Prepare samples/check/sub/a.txt, with no .txt file directly in samples/check. Set directoryPath=samples/check, conditionType=CONTAINS, extension=txt, searchRecursively=true, waitTimeSeconds=0.
Expected result
true; without subfolders it is false. NOTCONTAINS reverses the test, and is true for a missing folder. Access errors while listing files can fail the condition.