Your sample code almost exists, you just need to use file.attributes.mtimewhere you have it file.mtime.
In addition, I assume that the code in the question was just an example, but to execute it, you also need to pass the username and password to startand pass the path, as well as the template to glob. So a working example:
Net::SFTP.start('some_server', 'mike', :password => 'secret') do |sftp|
sftp.dir.glob('.', '*').each do |file|
puts file.attributes.mtime
end
end
, mtime, , Time.at Time.
, , :
permissionsuidgidsizeatime ( )