I'm looking to configure an ADF job to transfer .txt files from the source container using the Copy function and transfer them to an ADLS Sink container in their respective folders.
For example:
Source Container A Directory -fileA-20240201.txt -fileB-20240302.txt -fileB-20230201.txt -fileC-20230201.txt
Sink Container B Directory -Folder_A -Folder_B -Folder_C
transfer fileA* using wildcard and transfer those files to Folder_A. transfer fileB* using wildcard and transfer those files to Folder_B. transfer fileC* using wildcard and transfer those files to Folder_C.
Looking for help on config details setting up this ADF job.
Tried to use ForEach nested with a Switch Activity using Case Activity for each file name followed by copy activity.
If you knew the number of target folders and list of target folders, then you can try the below approach.
These are my sample input files:
First create an array variable with letters
["A","B","C",..<till required folders>]. Give this array to a For-Each activity.Create source dataset and target datasets. In target dataset, create a string parameter
folder_nameand give that to the folder path of the dataset like below.Inside for-loop, take a copy activity and give the created source and sink datasets. In the source, use the wild card path with this expression
file@{item()}*like below.In the sink, give the expression
Folder_@{item()}to the dataset parameter.Debug the pipeline and all required files will be copied to the respective folders like below.
Target folders:
Files created in the target folder:
My pipeline JSON: