Is there an easy way to get a list of files matching a specified filemask? By filemask I mean classic wildcard, not regexp.
I can use file-seq and then filter with regexp created from a wildcard. However, it is not trivial (consider escaping etc.)
I am also aware of FilenameUtils.wildcardMatch() from Apache Commons, but I'm reluctant to add such a dependency for a tiny tool I'm building.
There must exist something in the Clojure ecosystem I am not aware of.
clj-glob fits the bill: http://github.com/jkk/clj-glob
It may or may not be production-ready depending on your needs (e.g., hasn't been fully tested with Windows), but it has worked well for my purposes.
P.S., patches welcome.
I'm not aware of any such tool written in Clojure.
java.nio.file.PathMatcher can do wildcard matching, see http://download.oracle.com/javase/tutorial/essential/io/find.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With