简体   繁体   English

如何使用glob模式仅标记文件而不标记文件夹?

[英]How to only mark file not folder using glob pattern?

Consider the following file structure: 考虑以下文件结构:

root
   |- folder1
   |- folder2
   |- folderN
   |- file1
   |- file2
   |- fileN

How to target only files without excluding ( ! ) each folder one by one? 如何只定位文件而不将每个文件夹一一排除( ! )?

So you just want the files in that certain root directory, without the folders and contents of those folders. 因此,您只需要该特定根目录中的文件,而没有这些文件夹的文件夹内容。

The glob you are looking for is * . 您正在寻找的glob是* This one selects all the files inside the directory you are currently. 这将选择您当前目录内的所有文件。 Or use root/* if you want to select all the files inside the root folder without its subfolders. 或使用root/*如果要选择root文件夹中没有其子文件夹的所有文件。 To select subfolders and subfolder content, you have to use the Globstar: ** 要选择子文件夹和子文件夹的内容,您必须使用Globstar: **

You can test your glob easily here : 您可以在这里轻松测试您的glob:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM