SSIS tutorial: How to check if a file exists

Introduction

When building SSIS packages, it’s often necessary to verify whether a file exists before continuing with operations like loading, processing, or archiving. The ZappySys SSIS Validation Task makes this easy by allowing you to validate the existence of a file or directory as part of your control flow.

In this tutorial, you’ll learn how to use the ZS Validation Task to check if a file exists and how to route your control flow based on the result.

Prerequisites


Step-by-step guide

Step 1: Add the SSIS Validation Task

  1. Open your SSIS project and drag the ZS Validation Task from the SSIS Toolbox to the Control Flow surface.

  2. Double-click the task to open its configuration editor.

  3. Under Validation Type, select Check if file exists.

  4. For Input Mode, select Direct if you’re specifying a static file path. You can also use a variable or connection if the path is dynamic.

  5. In the Path field, enter the file path. You can use a wildcard to check for multiple files (e.g., C:\Files\*.csv). Enable Recursive Scan if you want to check all subdirectories.

  6. Set Expected Result to true to proceed only if the file exists.

  7. (Optional) Use the Output Variable field to store the result in an SSIS variable for later use.

  8. (Optional) Enable the Fail if validation fails checkbox to stop the package if the file is missing.

Step 2: Handle Success and Failure Paths

  1. Drag and drop two ZS Logging Tasks onto the Control Flow surface, one for success and one for failure handling.

  2. Select the Log Mode, Message type and enter a text with the variable result.

  3. Connect the ZS Validation Task to each logging task using precedence constraints: Green arrow (Success) to the success log task and red arrow (Failure) to the failure log task

Step 3: Run the Package

  1. Execute the SSIS package.
  2. Based on whether the file exists, the appropriate log task will run.

Use case examples

  • Abort the package if a required input file is missing.
  • Send a notification or log an error if a file is not found.
  • Proceed only if configuration or dependency files are present.
  • Apply conditional logic based on file or folder presence.

Conclusion

The ZappySys SSIS Validation Task offers a reliable and efficient way to check for file or folder existence directly within your SSIS package. Whether you’re ensuring the presence of input files or applying conditional logic, this task streamlines your control flow and prevents runtime errors.

Visit our official page to explore more SSIS components, automation features, and real-time data integration tools included in ZappySys SSIS PowerPack.


References

Contact us

If you encounter any issues or have specific questions, reach out to our support team via live chat or support ticket using our email support@zappysys.com.