Hi libpekin,
Thanks for reaching out to Microsoft Q&A.
You are trying to verify if a folder with a specific "yyyymm" format exists in your data lake, and create it if it doesn't. Based on the pipeline image you have shared, I will try to provide some guidance on how to modify your existing pipeline to achieve this:
- Lookup step: You are already getting the folder name from a database, which is good.
- Get Metadata: This step is retrieving the list of folders in your data lake.
- If Condition: You will need to modify this step to check if the folder exists.
To check if the folder exists and create it if not:
- Modify the "If Condition" step:
- Use an expression to check if the folder name exists in the metadata child items list.
- You can use the
contains()
function in your expression.
- True path (if folder doesn't exist):
- Add an activity to create the folder in your data lake.
- You might use a "Copy Data" activity with no source and the sink as your data lake, specifying the new folder path.
- False path (if folder exists):
- You can leave this as is or add any activities you want to perform when the folder already exists.
@not(contains(activity('Get Metadata').output.childItems.name, pipeline().parameters.folderName))
- You can leave this as is or add any activities you want to perform when the folder already exists.
The above code checks if the folderName
parameter (which should be your "yyyymm" formatted string) is not in the list of child item names from the Get Metadata activity.
For creating the folder, you'd use a Copy Data activity with these settings:
- Source: None (or a dummy source)
- Sink: Your Data Lake storage
- Folder path: Combine your base path with the new folder name
Can you try the above and let me know?
Please 'Upvote'(Thumbs-up) and 'Accept' as an answer if the reply was helpful. This will benefit other community members who face the same issue.