You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I try to use a regular expression to control which files I'd like to be copied and which files not, I end up with the function exiting on the first false result, thus not proceeding to actually check the files that are located in the folders, that need to be copied over. And the first false result is I presume the first folder that it tries to match against the regular expression which obviously fails.
Are regular expressions not supported and can't be used like this? The files do end up matching when I log them to the console, if I just put return true at the end of the filter function, but then again, that copies all files, and I don't really need that :)
I think there's an issue with a premature exit of the function in case it gets to a false result while filtering, even though it should continue cycling trough each folder / file. Or am I wrong and I've completely wrongly tried to use the filtering function?
P.S. It would be really great if the examples, more in particular the fse.copy() example is better put together, I couldn't realize what to do with the parameters and how to actually get the filtering done and most likely wouldn't have unless I stumbled upon another issue that was just recently opened mentioning the isDirectory() check, so props to that guy 😃
The text was updated successfully, but these errors were encountered:
The filter function is called for both files & directories; and if you return false for a directory, files inside it are not recursed. Currently, isDirectory is the correct way to make it work; it should work with your regexes then. #844 is a proposal to pass the stats directly to the filter function, so you don't have to make the stat call yourself.
fs-extra
version: 9.0.1Hi,
If I try to use a regular expression to control which files I'd like to be copied and which files not, I end up with the function exiting on the first false result, thus not proceeding to actually check the files that are located in the folders, that need to be copied over. And the first false result is I presume the first folder that it tries to match against the regular expression which obviously fails.
Are regular expressions not supported and can't be used like this? The files do end up matching when I log them to the console, if I just put return true at the end of the filter function, but then again, that copies all files, and I don't really need that :)
Example:
I had to end up with something like this to make it work:
I think there's an issue with a premature exit of the function in case it gets to a false result while filtering, even though it should continue cycling trough each folder / file. Or am I wrong and I've completely wrongly tried to use the filtering function?
P.S. It would be really great if the examples, more in particular the fse.copy() example is better put together, I couldn't realize what to do with the parameters and how to actually get the filtering done and most likely wouldn't have unless I stumbled upon another issue that was just recently opened mentioning the isDirectory() check, so props to that guy 😃
The text was updated successfully, but these errors were encountered: