I am connecting to remote server via ftp. How to get the remote file
version and time stamp? I also want to determine version and time stamp
for any local file whose path I provide as a parameter to a method.
Not sure if this is what you’re looking for, but here’s the timestamp at
least.
File#mtime
File.new(“testfile”).mtime #=> Wed Apr 09 08:53:14 CDT 2003
#this is assuming that you want to do something in Ruby if the file is
of a certain age
Class FTP
def timestamp(abs_path, cond, &block)
file = File.new(abs_path)
file.mtime == cond ? yield(file) : file.mtime
end
end
check out class File - RDoc Documentation
For the version, what kind of versioning are you talking about?
My bad if this isn’t what you’re asking for,
-Luke