Local Community

Exclude folders from export


Just wanted to share a tip on how to exclude folders from LocalWP exports, since I’ve noticed a few people have been trying to do that (namely to exclude node_modules) in the following topic, but without success :

From what I’ve noticed, the “File exclusion filter” when exporting seems to be using glob patterns, so if you want to exclude whole directories recursively you will need to add a filter using globstars **.

For example, to exclude all files in any node_modules folder within your site, you need to add this filter: **/node_modules/**. As mentioned, notice the use of globstars ** as opposed to */node_modules/* as someone suggested in the above-mentioned topic.

Hope this will help some of you people avoiding huge exports containing node_modules and other unnecessary stuff :slight_smile:

I’m having a hard time excluding the node_modules folder. /node_modules/ is not working for me, as /node_modules/ is not working either.
My node_modules folder is located in app/public/wp-content/themes/myTheme/node_modules, and I’m running Local for Windows.
I get an “Error compressing site”, when seeing the logs, this is the error I got:
{"thread":"worker","worker":"exportSiteWorker","message":"Error: EACCES: permission denied, scandir 'C:\\Users\\victor\\Local Sites\\dasturias\\app\\public\\wp-content\\themes\\myTheme\\node_modules\\.bin\\acorn'","level":"error","timestamp":"2021-09-09T09:16:38.088Z"}

Any clue on how can I exclude the node_modules folder?