9

I'm struggling with getting a TFS build definition to exclude an entire folder and all of its contents from a "Copy Files" step, as shown here: enter image description here

Here's essentially what I'm trying to do:

Copy everything except a folder named 'node_modules' from:

\\Test\Source

to:

\\Test\Destination

The path of the folder I need to exclude is:

\\Test\Source\AppsJs\v3\node_modules

I can easily exclude files using the same pattern as I have above, but I can't figure out how to exclude the entire folder.

I've also seen some suggesting using -: as well, but I haven't been able to get that to work.

I've tried looking at the "Copy Files" documentation here, and read some more here and here, but I'm still just missing something.

Any help is appreciated!

Community
  • 1
  • 1
Shaun Z.
  • 379
  • 1
  • 3
  • 11

2 Answers2

17

You should set the contents with two lines as:

**\**
!AppsJs\v3\node_modules\**
Marina Liu
  • 36,876
  • 5
  • 61
  • 74
  • Ahh! That got me on the right track at least, and I got it to totally exclude the `node_modules` folder by changing what you had, `\node_modules\*.*`, to `\node_modules\**`. Since I'm new here, should I still mark as answer even though it was a bit different, or can you edit your answer slightly to match what fixed it? Thanks!! – Shaun Z. Apr 10 '17 at 13:56
  • Thanks for your kindly reminder. I updated my answer just now. – Marina Liu Apr 10 '17 at 14:39
  • Thanks again for the help! – Shaun Z. Apr 10 '17 at 15:38
2

For anyone looking for a solution in 2020, here is what I did:

**/*
!.git/**
!node_modules/**
Tallal Kazmi
  • 361
  • 2
  • 13