25

I have a folder structure like this in my project...

Project/Folder1/Folder2
-File1
-File2
-File3

Project/Folder1/Folder3
-File4
-File5
-File6

Project/Folder1/Folder4
-File7
-File8

In a NuSpec definition file, how can I tell it to include everything under Folder1 (folders and files recursively)?

Can I just do this or do I need a double ** or what?

<file src="Project\Folder1\*.*" target="Project/Folder1" />
kyleb
  • 1,968
  • 7
  • 31
  • 53

1 Answers1

54

You can use the wildcard ** which is documented on the NuGet web site. From the NuGet docs:

Using a double wildcard, **, implies a recursive directory search.

<file src="tools\**\*.*" exclude="**\*.log" />
<file src="lib\**" target="lib" />
Matt Ward
  • 47,057
  • 5
  • 93
  • 94
  • Do I just need the Folder1\\** or do I need to do Folder1\\***\\**.* to get the files to...or will the two asterix's after the Folder1\ be enough to recurse all folders and files? – kyleb Jun 16 '14 at 19:16
  • Either will work. They have both examples on the NuGet website. – Matt Ward Jun 16 '14 at 19:33
  • Now I get this error when CruiseControl and Octopus work together to perform the build using my nuspec file.
    Could not find a part of the path 'C:\Program Files (x86)\CruiseControl.NET\server\DMG\WorkingDirectory\DMGUmbraco\App_Browsers'
    My file is like this . This directory exists! The directory is only level deep, so no need for ** folder recursion.
    – kyleb Jun 16 '14 at 19:56
  • IIRC `**.*` will recursively match any file with an extension. `**` will recursively match any file regardless of whether it has an extension. – Myster Jul 30 '17 at 22:07