user2841795
user2841795

Reputation: 405

How do I extract a file name from the filepath column using ADF expression builder?

I would like to get filename from below path using Visual expression builder in dataflow derived column in data factory.

/datafactory/raw/files/filename.csv

every row has got filepath. So filename is required in every row.

Upvotes: 0

Views: 2379

Answers (1)

Steve Johnson
Steve Johnson

Reputation: 8660

If the count of / is fixed in your filepath, such as /datafactory/raw/files/filename.csv, you can use this expression in Derived Column:split(filepath,'/')[5].Otherwise, you can try this expression:split(filepath,'/')[size(split(filepath,'/'))].

Data preview of Derived Column:

enter image description here

Upvotes: 4

Related Questions