Sha256: f20ea037c9f7a0a438b1e36d1f18f51751f35e77cd12a2723ccc4163d1745b67
Contents?: true
Size: 983 Bytes
Versions: 9
Compression:
Stored size: 983 Bytes
Contents
module BabyBro module Files def file_timestamp( filename ) file = File.new(filename) mtime = file.mtime file.close mtime end def touch_file( filename, time ) `touch -t #{time.strftime("%Y%m%d%H%M.%S")} #{filename}` end # returns files in the specified directory def find_files( directory, pattern='*') `find #{directory} -name "#{pattern}"`.split("\n").reject{|f| f==directory} end # returns files in the specified directory that are newer than the specified file def find_files_newer_than_file( directory, filename ) `find #{directory} -newer #{filename}`.split("\n") end # returns files in the specified directory that are newer than the time expression # time_interval_expression is in english, eg. "15 minutes" def find_recent_files( directory, time_interval_expression ) `find '#{directory}' -newermt "#{time_interval_expression} ago"`.split("\n") end end end
Version data entries
9 entries across 9 versions & 1 rubygems