Skip to content

Instantly share code, notes, and snippets.

@chikadance
Created April 6, 2013 03:20
Show Gist options
  • Save chikadance/5324595 to your computer and use it in GitHub Desktop.
Save chikadance/5324595 to your computer and use it in GitHub Desktop.
Get lastest filename
class Tool
def get_lastest()
Dir.glob("**/**/*.rb") do |filename|
puts "filename: #{filename},atime:#{File.stat(filename).atime}"
end
# get filename with most access time ##!! use min, but max
Dir.glob("**/**/*.rb").sort { |a, b| File.stat(a).atime <=> File.stat(b).atime }.min
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment