Hi, I am trying to write a script that will remove directories that are
older than 5 days old. I can’t seem to get the datetime for the
directory to be usable for comparison.
Dir.foreach("/mydir/") do |entry|
etime = File.stat(entry)
vAgeInDays = ageInDays( etime.ctime )
if vAgeInDays > 5
ydate = Time.new
ydate = ydate - ( 24 * 60 * 60 * days)
I keep getting the error Time can’t be coerced into Fixnum (TypeError).
Can someone point out what I am doing wrong?