cancel
Showing results for 
Search instead for 
Did you mean: 

How to capture file name of a file read from SFTP

Darshita
New Contributor II

How can we capture the name of the file picked up from the SFTP if we are reading multiple files at a time?

Eg: sftp://path/*.csv

I need to know which file each document belongs to.

Appreciate the help.

Regards,
Darshita

3 REPLIES 3

Supratim
Contributor III

@Darshita Use directory browser snap,it will provide you all necessary details about the file. Then use another child pipeline and pass file path/filename to read file. To track the processed filename, can use level in Pipeline Execute snap.

cstewart
Former Employee

See the attached example.CS-Binary-addFileNametodata_2020_11_30.slp (7.9 KB)
If you read the file, then use the Binary Router, you can get the filename, put that out on a second output, as document type, and then join that to the data.

image

Darshita
New Contributor II

Thank you! I was able to get this done with the help of directory browser snap.