Documentation for copy() options.filter function
See original GitHub issueI’m not sure how to use the options.filter
function with copy()
.
The docs say:
Function to filter copied files. Return true to include, false to exclude.
I need to copy a folder and sub files/folders, however I need to exclude some from the copy (I’m copying a node project folder and need to exclude the node_modules
folder within). The above makes it sound like this function can used but I’m not sure how.
Can this function be used for what I need…?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:5
- Comments:21
Top Results From Across the Web
Array.prototype.filter() - JavaScript - MDN Web Docs
The filter() method creates a shallow copy of a portion of a given array, filtered down to just the elements from the given...
Read more >Google Sheets FILTER function: what it is and how to use it
Learn how to use the powerful Google Sheets filter function to filter (display) your datasets based on specific criteria.
Read more >filter(_:) | Apple Developer Documentation
Returns an array containing, in order, the elements of the sequence that satisfy the given predicate.
Read more >FILTER function - Google Docs Editors Help
Returns a filtered version of the source range, returning only rows or columns that meet the specified conditions. Examples Make a copy.
Read more >Filter, Search, and LookUp functions in Power Apps
The Filter function finds records in a table that satisfy a formula. ... (Optional) In the Layout list, select different options.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@stephen-last You may have the same puzzle as I had. When copying directory and use the filter to include/exclude files in subdirectory, it actually filters from the root first. If the root folder does not match the filter function, it did not go to the subdirectory at all. To make it work as expected, I use this workaround. here
if (fs.lstatSync(n).isDirectory()) {return true}
is needed to bypass the root folder to have chance to match sub directories and files.This gives output like this.
Quick example:
We should add an example to the docs.