Find.find("d") {|path| puts path}
I want to exclude certain type of files, say *.gif
and directories
.
PS: I can always add code inside my block to check for the file name and directory type, but I want find
itself to filter files for me.
I don't think you can tell find to do that.You could try using Dir#[]
, which accepts file globs. If you are looking for particular types of files, or files that can be filtered with the file glob pattern language, it may be a better fit.
eg
Dir["dir/**/*.{xml,png,css,html}"]
would find all the xml, png, css, and html files under the directory d.
Check out the docs for more info.
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