[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

mtime for ftp

Peter Bailey

10/19/2007 5:25:00 PM

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
--
Posted via http://www.ruby-....

3 Answers

Eric Hodel

10/22/2007 4:02:00 PM

0

On Oct 19, 2007, at 10:25 , Peter Bailey wrote:
> 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.

--
Poor workers blame their tools. Good workers build better tools. The
best workers get their tools to do the work for them. -- Syndicate Wars



Peter Bailey

10/22/2007 7:26:00 PM

0

Eric Hodel wrote:
> On Oct 19, 2007, at 10:25 , Peter Bailey wrote:
>> 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.

Thanks. I don't even know what MDTM is. It's obviously part of Ruby's
ftp, though, isn't it?
--
Posted via http://www.ruby-....

Eric Hodel

10/23/2007 5:37:00 PM

0

On Oct 22, 2007, at 12:25 , Peter Bailey wrote:
> Eric Hodel wrote:
>> On Oct 19, 2007, at 10:25 , Peter Bailey wrote:
>>> 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.
>
> 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.

--
Poor workers blame their tools. Good workers build better tools. The
best workers get their tools to do the work for them. -- Syndicate Wars