Problem with Net::FTP#mtime

D

Daniel Berger

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=20
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':=20
command not understood. (Net::FTPPermError)
from /opt/csw/lib/ruby/1.8/net/ftp.rb:264:in `sendcmd'
from /opt/csw/lib/ruby/1.8/monitor.rb:229:in `synchronize'
from /opt/csw/lib/ruby/1.8/net/ftp.rb:262:in `sendcmd'
from /opt/csw/lib/ruby/1.8/net/ftp.rb:767:in `mdtm'
from /opt/csw/lib/ruby/1.8/net/ftp.rb:699:in `mtime'

Am I doing something wrong here? I don't see anything like 'MDTM' =
mentioned in=20
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=20
prohibited and may be unlawful. If you have received this communication =

in error, please immediately notify the sender by reply e-mail and =
destroy=20
all copies of the communication and any attachments.
 
J

James Cribbs

Daniel said:
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:in `sendcmd'
from /opt/csw/lib/ruby/1.8/monitor.rb:229:in `synchronize'
from /opt/csw/lib/ruby/1.8/net/ftp.rb:262:in `sendcmd'
from /opt/csw/lib/ruby/1.8/net/ftp.rb:767:in `mdtm'
from /opt/csw/lib/ruby/1.8/net/ftp.rb:699:in `mtime'

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Net::FTP hangs 7
Anybody tell me about net/ftp protocol ? 2
Error using net::ftp 1
mtime for ftp 3
net/ftp issue 2
FTP problem under Linux? 0
Net::FTP puttextfile question 2
open-uri and ftp path 2

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top