mtime for ftp

P

Peter Bailey

Hi,
I'd like to go to an ftp site and check the dates of available files
there. (I only want today files.) I see that ftp, from 'net/ftp' has an
mtime method. But, I can't seem to get it to work. Here's what I've
tried.

...
xmlfiles = ftp.list('*.xml')
xmlfiles.each do |xmlfile|
puts xmlfile
puts ftp.mtime(xmlfile)
end
...

I get something like this:

Exception: 500 'MDTM -rw-rw-r-- 1 bna staff 43945 Oct 19
08:50 lobbyreg-20071010-160009.xml': command not understood.

Just doing the "puts xmlfile" works fine, just not the mtime thing.

Thanks,
Peter
 
E

Eric Hodel

Hi,
I'd like to go to an ftp site and check the dates of available files
there. (I only want today files.) I see that ftp, from 'net/ftp'
has an
mtime method. But, I can't seem to get it to work. Here's what I've
tried.

...
xmlfiles = ftp.list('*.xml')
xmlfiles.each do |xmlfile|
puts xmlfile
puts ftp.mtime(xmlfile)
end
...

I get something like this:

Exception: 500 'MDTM -rw-rw-r-- 1 bna staff 43945 Oct 19
08:50 lobbyreg-20071010-160009.xml': command not understood.

Just doing the "puts xmlfile" works fine, just not the mtime thing.

I don't think every server supports MDTM.
 
E

Eric Hodel

Thanks. I don't even know what MDTM is. It's obviously part of Ruby's
ftp, though, isn't it?

Actually, it looks like you're not passing the filename, but are
passing a bunch of file metadata along with the file's name.

I presume MDTM is the command you send to the FTP server to get it to
return the modification time, like GET.
 

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

Problem with Net::FTP#mtime 1
Deleting files with Net/ftp 1
preserve mtime when using FTP? 1
net/ftp issue 2
Net::FTP hangs 7
newbie problem 6
Net::FTP questions... 5
Net::FTP and IBM TSO :-( 15

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,071
Latest member
MetabolicSolutionsKeto

Latest Threads

Top