I am using Azure CopyFiles@2 in pipeline.yaml file to copy json file from root folder to drop location, but it’s copying everything.
I have tried below code.
- task: CopyFiles@2
displayName: "Copy Files to: $(DropLocation)"
condition: always()
inputs:
SourceFolder: $(build.sourcesdirectory)
Contents: "**/*.json"
TargetFolder: "$(DropLocation)"
flattenFolders: true
Please let me know the correct pattern to copy only json files which are at $(build.sourcesdirectory) location.
Your task setting will copy all *.json files including the ones in subfolders, it won’t copy everything. If you are checking the
$(DropLocation)
content, make sure it’s empty before the task.