Reputation: 267
I have a copy data activity in ADF and I want to segregate the files into a different container based on the file type.
ex. Container A - .jpeg, .png Container B - .csv, .xml and .doc
My initial idea was to use 'if condition' and 'or' statement but looks like my approach won't work. I'd appreciate it if you could give some inputs.
Upvotes: 0
Views: 715
Reputation: 5074
First, get the list files from the source container and loop each file in the Foreach
activity to check the extension using If condition
and copy files based on the condition to their respective containers.
I have the below files in my source container.
In ADF:
Get metadata
activity, get the list of all files from the source container.Foreach
activity.@activity('Get Metadata1').output.childitems
Foreach
activity, add If Condition
activity to separate the files based on extension.@or(contains(item().name, '.xml'),contains(item().name, '.csv'))
Files in the container after running the pipeline.
Container1:
Container2:
Upvotes: 1
Reputation: 2920
You should use the GetMetadata
activity to first get all the file types that needs to be first passed to a CopyData
activity which copies to Container A, and then add next Getmetadata activity to get file types for next copydata activity that copies to container B.
so, your ADF pipeline may be like GetMetaData1 - > Copydata1 -> GetMetaData2 -> Copydata2. Refer how to use GetMetaData activity in this article, and documentation
Copy activity itself allows more than one wildcard path
, so you could use that in the Data source, see this.
Upvotes: 1