2

Consider the following file structure:

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

How to target only files without excluding (!) each folder one by one?

Handsome Nerd
  • 17,114
  • 22
  • 95
  • 173

1 Answers1

2

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 *. 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. To select subfolders and subfolder content, you have to use the Globstar: **

You can test your glob easily here:

ddprrt
  • 7,424
  • 3
  • 29
  • 25
  • Thanks. While your linked site show the desired result, it actually will mach folders without content. If for example you want use that glob to copy that place to anther location using gulp, if will copy empty folders as well. – Handsome Nerd Sep 15 '15 at 11:34