From: Zachary Holt Date: 2007-06-05T14:45:53+09:00 Subject: Re: Newbie... help with permissions On Jun 4, 2007, at 10:24 PM, Micah Carrick wrote: > Hey ya'll. Hey. > I'm brand new to Ruby. Welcome. This is my first post to this list. So we're on a par. > def delete_if_old(file) > t = (Time.new-(60*60*24*30)).strftime("%Y%m%d_%H%M%S").to_i You might want Time.now.to_i + ( 60 * 60 * 24 * 30 ) > if file.to_i < t You're calling to_i on a String here. I bet that "if" clause always hits. > File.delete(LOG_DIR + file) > end > end > > Dir.foreach(LOG_DIR) { |f| delete_if_old f } > #--------------------------------------------------------------------- > ---------- Is it possible that the first time delete_if_old is called, it's passed "." (dot)?