How do I write a loop in ruby so that I can execute a block of code on each file?
I\'m new to ruby, and I\'ve concluded that the way to do this is a do each loop.
Dir.foreach("/home/mydir") do |fname| puts fname end
The find library is designed for this task specifically: https://ruby-doc.org/stdlib-2.5.1/libdoc/find/rdoc/Find.html
require 'find' Find.find(path) do |file| # process end
This is a standard ruby library, so it should be available