windows 文件路径中的两个星号

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8532929/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 09:01:36  来源:igfitidea点击:

Two asterisks in file path

windowsmsbuildfilepath

提问by Arnthor

What does the following file path mean?

以下文件路径是什么意思?

$(Services_Jobs_Drop_Path)\**\*.config

The variable just holds some path, nothing interesting. I'm a lot more concerned, what the hell the **mean. Any ideas?

该变量只包含一些路径,没什么有趣的。我更担心,这到底**是什么意思。有任何想法吗?

P.S. The following path is used in msbuild scripts, if it helps.

PS以下路径用于msbuild脚本中,如果有帮助的话。

回答by sll

\**\This pattern is often used in Copy Taskfor recursive folder tree traversal. Basically it means that all files with extension configwould be processed from the all subdirectories of $(Services_Jobs_Drop_Path)path.

\**\这种模式通常用于复制任务中,用于递归文件夹树遍历。基本上这意味着所有带有扩展名的文件config都将从$(Services_Jobs_Drop_Path)路径的所有子目录中处理。

MSDN, Using Wildcards to Specify Items:

MSDN,使用通配符指定项目

You can use the **, *, and ? wildcard characters to specify a group of files as inputs for a build instead of listing each file separately.

  • The ? wildcard character matches a single character.
  • The * wildcard character matches zero or more characters.
  • The ** wildcard character sequence matches a partial path.

您可以使用 **、* 和 ? 通配符指定一组文件作为构建的输入,而不是单独列出每个文件。

  • 这 ?通配符匹配单个字符。
  • * 通配符匹配零个或多个字符。
  • ** 通配符序列匹配部分路径。

MSDN, Specifying Inputs with Wildcards

MSDN,使用通配符指定输入

To include all .jpg files in the Images directory and subdirectories Use the following Include attribute:

Include="Images\**\*.jpg"

要将所有 .jpg 文件包含在 Images 目录和子目录中,请使用以下 Include 属性:

包括="图像\**\*.jpg"