In this article, you will learn how to use TimeXtender Orchestration to check that a required file exists at a specific path before running dependent processes. This is useful when your data pipeline depends on a file being placed in a known location — for example, a JSON configuration file, a flat file export from an upstream system, or a lookup table.
Note: This article covers checking whether a file exists. For checking whether a file is accessible and not locked (e.g., an Excel file currently open by a user), see: Verify if an Excel File is Accessible and Not Locked. For checking the content of text files, see: Notify when text files contain a pattern using PowerShell and RegEx.
How It Works
A PowerShell package uses Test-Path to check for the file's existence. If the file is found, a success message is written to the console and the package exits successfully. If the file is not found, an exception is thrown, triggering any configured Orchestration failure notifications.
Steps
- Open TimeXtender Orchestration and Data Quality Desktop.
- Right-click Packages in the Object Explorer.
- Select New → PowerShell.
- Give the package a descriptive name, for example: Check File Exists – awsales.json.
- Select an Execution Connection targeting the gateway server that has access to the file path.
- Enter the following script, replacing the file path with your file's location:
$filePath = 'C:\temp\semantic-layers\awsales.json'
if (Test-Path -Path $filePath) {
Write-Output "[$filePath] File exists. No action needed."
exit 0
}
throw "[$filePath] File not found."
- Click Save.
Notes
Test-Pathworks for both file paths and directory paths.- Place this package before any packages that depend on the file, so it acts as a pre-condition gate.
- For UNC paths on a network share, use the full UNC path (e.g.,
\\server\share\file.csv) accessible from the gateway server. - To check for multiple files, extend the script with an array and loop, or create one package per file.
Reuse with Query Snippets
Save this script as a Query Snippet in TimeXtender Orchestration. Create one package per file to check, updating the $filePath variable in each instance.