How can I check to see if a directory is empty or not in Ruby? Is there something like:
Dir.exists?(\"directory\")
(I know that that functi
Here is my template for this one.FYI , i am looking for a certain match of files inside the source.
mydir = "/home/to/mydir"
Dir.chdir(mydir)
if Dir.entries(mydir).select(|x| x != '.' && x != '..' && x =~ /\regex.txt\z/).size > 0
do_something
elsif Dir.entries(mydir).select(|x| x != '.' && x != '..' && x =~ /\regex.txt\z/).size < 0
do_something_else
else
puts "some warning message"
end
let me know if anything :)