How to check if file exists

bk 466 Reputation points
2020-09-21T16:40:47.737+00:00

Hi All,
I have a copy job that fails when the file doesn't exist on the SFTP Server.
Current scenario :
Source SFTP Server
Target is ADLS Gen2
The pipeline runs fine when a file exits , but fails when there is no file , which is expected. How to overcome this issue? In SSIS there is a script task which checks if file exists or not , if file exists it executes the package else not.
Can someone please guide me in the right direction?

Thanks

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. MartinJaffer-MSFT 26,161 Reputation points
    2020-09-21T17:14:24.987+00:00

    Hello @bk and thank you for your question.

    The Validation activity can be used to check whether a file exists or not. It can also be used to wait until a file exists, or is a certain size.

    In the validation activity, you specify several things. The dataset you want to validate the existence of, sleep how long you want to wait between retries, and timeout how long it should try before giving up and timing out. The minimum size is optional.

    Be sure to set the timeout value properly. The default is 7 days, much too long for most jobs.

    If the file is found, the activity reports success.
    If the file is not found, or is smaller than minumum size, then it can timeout, which is treated like a failure by dependencies.

    Please let me know if your question was actually "How do I make my pipeline not report failure when file is missing?"


  2. bk 466 Reputation points
    2020-09-21T20:03:48.97+00:00

    Thanks Again, please see the screen shot, is that correct?
    26155-capture921.png


  3. Bill Bird 81 Reputation points
    2020-09-21T23:31:35.397+00:00

    The validation doesn't work like you think it does...I had trouble too. The last activity is waiting to hear from ALL the activities. Hopefully this picture will help.

    26281-screenshot.png


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.