Skip to main content

Check if a File Exists Using TimeXtender Orchestration

  • March 2, 2026
  • 0 replies
  • 5 views

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

  1. Open TimeXtender Orchestration and Data Quality Desktop.
  2. Right-click Packages in the Object Explorer.
  3. Select NewPowerShell.
  4. Give the package a descriptive name, for example: Check File Exists – awsales.json.
  5. Select an Execution Connection targeting the gateway server that has access to the file path.
  6. 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."
  1. Click Save.

Notes

  • Test-Path works 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.