Search code examples
azure-data-factorysftp

Check if two files are existing in SFTP using ADF


I have two files (xlsx & pdf) in sftp folder. These are the requirements I need to complete:

  • if two files are existing proceed to the True condition databricks notebook. If one is not present, will proceed to False condition databricks notebook.

Edited: This is what I tried first. Used get metadata and If condition activity. get metadata activity

If condition activity expression: If condition activity expression

The two files are existing so I am expecting to receive the notebook in True condition, however, notebook in False condition is running.


Solution

  • Thanks to Rakesh Govindula for the solution. I tried this one if I know the filenames from sftp:

    @and(contains(string(activity('Get Metadata1').output.childItems),concat('DA_12345','.pdf')), contains(string(activity('Get Metadata1').output.childItems),concat('DA_12345','.xlsx')))  
    

    This is also working if you just want to check the files if contains specific string on the files:

    @and(contains(string(activity('Get Metadata1').output.childItems),'.pdf'), contains(string(activity('Get Metadata1').output.childItems),'.xlsx'))