0
votes

I have the following pipeline: enter image description here

Get Metadata1 basically retrieves child items (which is collection of folders i.e. originalFolder1, originalFolder2, etc..).

Inside ForEach1 activity, I put copy data activity.

When defining the source dataset, I would like to use the retrieved folder name as the path. So It would be like this: staticFolder1/staticFolder2/originalFolder1.

I did try using staticFolder1/staticFolder2/@item().name in the folder path but it always throw an error file not found

Am I missing something?

2
Where did you copy it from, is it a storage account? - Cindy Pau
@BowmanZhu both source and sink are from DataLake - OreoFanatics

2 Answers

0
votes

unfortunately, in ADF you can't mix string and expression, you can only have one or the other

what you can do is:

@concat(variables('SourceFolderName'), '/', string(item().name) )

say if you have a variable called SourceFolderName, which can be useful if your source folder is different everyday; otherwise make it as a string

@concat('staticFolder1/staticFolder2/', string(item().name) )

then you can concatenate the ForEach activity's item to form the complete path

0
votes

The comments provided by @sowmen makes sense, but it's not necessary to convert the item().name to string format.

There is an other interesting concept called String Interpolation, which makes our life more easier. Please see below the code that fits your scenario. Hope it helps :)

staticFolder1/staticFolder2/@{item().name}