From: Cory Wilkerson Date: 2007-10-14T02:09:41+09:00 Subject: Better way to kill files? Purpose here is to find all files > 5 hours old in a directory and wipe them... Of course I could just write a shell script but I wanted to leverage ruby...or, rather, needed to leverage ruby...not real familiar with the File and FileUtils API just yet... dir_path = "~/foo/bar" Dir.new(dir_path).each {|file| if file.include?('foobar') afile = File.new("#{dir_path}/#{file}") if (Time.now - afile.mtime)/60/60 > 5 File.delete("#{dir_path}/#{file}") end end } -- Posted via http://www.ruby-forum.com/.