Glob.sync(path.join())

Hi,

I'd like to know... i'm using this :

const toutesmesMaps = glob.sync(path.join(__dirname, '../Maps/*.expressionmap'));

to get all the expressionmaps in my folder "Maps".

But i have subfolders, in this folder, containing expressionmaps too...

Before i move all my files, is there a way to get all the expressionmaps both in Maps folder and Maps subfolders, in a short const definition ?...

Thank you

In vB you can set up a simple loop that runs through all the sub-directories in the directory and built up an object or array of the files or data that way - I don’t know JS well enough but perhaps there is a way to do that?

<psudoCode>

Count the sub directory number then 

For i = 1 to i = subdirectory.number

Open sub directory
Get all the expressionmap data
Add data to big list of data

Next i 

</psudoCode>

Probably not very efficient though.

Thank you @Sub3OneDay. I'll have a look this way. Not sure i'll fight too long with that :slight_smile:

Have a look here then - this might help

Files and directory searching on stack

Thank you @Sub3OneDay.

Here it is... before posting this thread, i tried to use *...
And the link you gave here just says : use ** ... :upside_down_face:

So it works perfectly with

const toutesmesMaps = glob.sync(path.join(__dirname, '../Maps/**/*.expressionmap'));

or even with

const toutesmesMaps = glob.sync(path.join(__dirname, '../**/*.expressionmap'));

Thank you :wink:

Brilliant- glad to help as you’ve now helped me solve a similar problem!

We rock ! :smiley: :metal: