Problem with Net::FTP#mtime

Hi all,

Ruby 1.8.4
Solaris 10, connecting to a Solaris 8 remote host.

I’ve got a code snippet like the one below. It connects fine, performs
the
chdir fine, performs the nlst fine, but chokes on mtime:

FTP.open(host, user, password) do |ftp|
ftp.chdir(some_dir)
ftp.nlst.each{ |file|
puts file # prints “audit17717447” fine
puts ftp.mtime(file, true) # Boom! See below
}
end

Results:

/opt/csw/lib/ruby/1.8/net/ftp.rb:243:in getresp': 500 'MDTM audit17717447': command not understood. (Net::FTPPermError) from /opt/csw/lib/ruby/1.8/net/ftp.rb:264:insendcmd’
from /opt/csw/lib/ruby/1.8/monitor.rb:229:in synchronize' from /opt/csw/lib/ruby/1.8/net/ftp.rb:262:insendcmd’
from /opt/csw/lib/ruby/1.8/net/ftp.rb:767:in mdtm' from /opt/csw/lib/ruby/1.8/net/ftp.rb:699:inmtime’

Am I doing something wrong here? I don’t see anything like ‘MDTM’
mentioned in
my ftp man page. Or is it time to parse the long file name format
manually?

Thanks,

Dan

This communication is the property of Qwest and may contain confidential
or
privileged information. Unauthorized use of this communication is
strictly
prohibited and may be unlawful. If you have received this communication
in error, please immediately notify the sender by reply e-mail and
destroy
all copies of the communication and any attachments.

Daniel B. wrote:

ftp.nlst.each{ |file|
from /opt/csw/lib/ruby/1.8/monitor.rb:229:in synchronize' from /opt/csw/lib/ruby/1.8/net/ftp.rb:262:insendcmd’
from /opt/csw/lib/ruby/1.8/net/ftp.rb:767:in mdtm' from /opt/csw/lib/ruby/1.8/net/ftp.rb:699:inmtime’

Am I doing something wrong here? I don’t see anything like ‘MDTM’
mentioned in my ftp man page. Or is it time to parse the long file
name format manually?
I’ve had the same problem. Sometimes #mtime will work, sometimes not.
It seems to depend on the ftp server I’m going against. IIRC, I
couldn’t get it to work going against Windows2000 ftp services, so I
ended up parsing the long file name format myself.

Jamey

Confidentiality Notice: This email message, including any attachments,
is for the sole use of the intended recipient(s) and may contain
confidential and/or privileged information. If you are not the intended
recipient(s), you are hereby notified that any dissemination,
unauthorized review, use, disclosure or distribution of this email and
any materials contained in any attachments is prohibited. If you receive
this message in error, or are not the intended recipient(s), please
immediately notify the sender by email and destroy all copies of the
original message, including attachments.