Reputation: 15303
I'm trying to delete all files in any directory matching a set of patterns in my build output directory before publishing and it's not finding anything that matches the pattern I have defined. The pattern I'm using is:
**\?(*.cfg|*.config|*.xml)\**
I enabled system.debug in my build and I can see the following file being seen in the source directory I specified:
2018-03-12T00:43:31.5264940Z ##[debug] C:\agent3\_work\3\nsis_workspace\AutoBagPack.log4net.config
2018-03-12T00:43:31.5264940Z ##[debug] is a file
The above file should match the *.config
portion of my minimatch pattern but at the end of the log for this task I see:
2018-03-12T00:43:32.4327498Z ##[debug]2454 results
2018-03-12T00:43:32.4327498Z ##[debug]match patterns: C:\agent3\_work\3\nsis_workspace\**\?(*.cfg|*.config|*.xml)\**
2018-03-12T00:43:32.4327498Z ##[debug]match options: [object Object]
2018-03-12T00:43:32.4327498Z ##[debug]applying pattern: C:\agent3\_work\3\nsis_workspace\**\?(*.cfg|*.config|*.xml)\**
2018-03-12T00:43:32.5108753Z ##[debug]matched 0 items
My source path is defined as and can be seen in the log as:
2018-03-12T00:43:31.4952438Z ##[debug]SourceFolder=C:\agent3\_work\3\nsis_workspace
2018-03-12T00:43:31.4952438Z ##[debug]BuildCleanup=null
2018-03-12T00:43:31.4952438Z ##[debug]patterns: C:\agent3\_work\3\nsis_workspace\**\?(*.cfg|*.config|*.xml)\**
Why are all the *.cfg, *.config, *.xml files not being deleted?
Upvotes: 0
Views: 556
Reputation: 33698
Using this code instead in Delete Files task (multiple lines):
**/*.cfg
**/*.xml
**/*.config
Or
**/?(*.xml|*.cfg|*.config)
Upvotes: 4