Rinks.I implemented your requirement with GetMetadata Activity,If-Condition Activity,For each Activity and Delete Activity. Please see my detailed steps:
Step1, i created 2 empty folders and 1 folder contains one csv file in the root path.
Step2, create GetMetadata Activity in the ADF pipeline and output the childItems
.
Step3, loop the output by ForEach Activity:@activity('Get Metadata1').output.childItems
Total structure like:
Step4,Inside ForEach Activity,use another GetMetaData Activity and If-condition Activity:
Set the Directory as @item().name
Set the condition expression as @empty(activity('Get Metadata2').output.childItems)
Total structure like:
Step5,set Delete Activity as the Failed Activity of For each Activity. Set the @item.name()
as directory of Delete Activity Dataset.
Test result,test2
and test3
folder are deleted:
Any concern,pls let me know.