Forum Discussion
Copy Data in Fabric
- 1 year ago
Hi tan_thiamhuat,
start by configuring a Get Metadata activity. Use a dataset that points to your SFTP server, and apply a wildcard path such as customer_*.csv to target the expected files. In the field list of the activity, select Child Items.
After setting up the metadata check, insert an If Condition activity named "If No File". Use the expression @equals(length(activity('Get Metadata - Customer File').output.childItems), 0) to evaluate whether any files were returned. If the result is true (i.e., no files found), route the pipeline to a Fail activity with an appropriate error message like "No customer files found in SFTP. Failing pipeline." If files are found (false path), the pipeline proceeds to a Copy Activity, where it transfers the files to the destination as per your data flow logic.
Thanks,
Prashanth Are
MS Fabric community support
are you able to do some printscreen to illustrate? How do we detect if there is a file in the SFTP Server?
Hi tan_thiamhuat,
start by configuring a Get Metadata activity. Use a dataset that points to your SFTP server, and apply a wildcard path such as customer_*.csv to target the expected files. In the field list of the activity, select Child Items.
After setting up the metadata check, insert an If Condition activity named "If No File". Use the expression @equals(length(activity('Get Metadata - Customer File').output.childItems), 0) to evaluate whether any files were returned. If the result is true (i.e., no files found), route the pipeline to a Fail activity with an appropriate error message like "No customer files found in SFTP. Failing pipeline." If files are found (false path), the pipeline proceeds to a Copy Activity, where it transfers the files to the destination as per your data flow logic.
Thanks,
Prashanth Are
MS Fabric community support