Forum: Ruby Ways to find File MetaData information?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Adc6f0b0bc40b0ac4fc3f1ca5000cd38?d=identicon&s=25 Dinesh Umanath (udinesh)
on 2006-04-10 08:53
Hi,

Is there a way were we can find about the "meta data information" of an
existing file in the directory using  ruby,  like

1)When the file was created,
2)When was it modifed
3)when was it accessed.  etc.


ie. If we pass the "name/location  of the file" it should print the
creation / modified time of that particular file.


Thank You,
Dinesh
Ffcb418e17cac2873d611c2b8d8d891c?d=identicon&s=25 unknown (Guest)
on 2006-04-10 10:07
(Received via mailing list)
> creation / modified time of that particular file.
To the best of my knowledge, Unix / Posix file systems only give you a
modification date (your OS may differ :). You can access that using some
of the class methods of File. You'll probably be "feeling lucky" at
google if you throw it "ruby File class".

Cheers,
  Ben
245cfab887781bdf3f53178b794c42dc?d=identicon&s=25 Alexandru E. Ungur (Guest)
on 2006-04-10 10:16
(Received via mailing list)
>>> sender: "Dinesh Umanath" date: "Mon, Apr 10, 2006 at 03:53:27PM +0900" <<<EOQ
> Hi,
Hi,

> Is there a way were we can find about the "meta data information" of an
> existing file in the directory using  ruby,  like
>
> 1)When the file was created,
> 2)When was it modifed
> 3)when was it accessed.  etc.
Yes, there is: http://www.rubycentral.com/ref/ref_c_file.html
Just look for the *time methods.

Regards,
Alex
Bc6d88907ce09158581fbb9b469a35a3?d=identicon&s=25 James Britt (Guest)
on 2006-04-10 16:15
(Received via mailing list)
Alexandru E. Ungur wrote:
>>1)When the file was created,
>>2)When was it modifed
>>3)when was it accessed.  etc.
>
> Yes, there is: http://www.rubycentral.com/ref/ref_c_file.html

That page has docs for Ruby 1.6.  You may prefer to look at the 1.8.4
(i.e. current stable release) docs:

http://ruby-doc.org/core/classes/File.html

--
James Britt

"In physics the truth is rarely perfectly clear, and that is certainly
  universally the case in human affairs. Hence, what is not surrounded
by
  uncertainty cannot be the truth."
  - R. Feynman
245cfab887781bdf3f53178b794c42dc?d=identicon&s=25 Alexandru E. Ungur (Guest)
on 2006-04-10 22:24
(Received via mailing list)
>>> sender: "James Britt" date: "Mon, Apr 10, 2006 at 11:14:03PM +0900" <<<EOQ
> > [..]
> >Yes, there is: http://www.rubycentral.com/ref/ref_c_file.html
>
> That page has docs for Ruby 1.6.  You may prefer to look at the 1.8.4
> (i.e. current stable release) docs:
>
> http://ruby-doc.org/core/classes/File.html
Oh, I would definitely prefer that :) thank you!

I was using the other one simply because it was listed here:
http://www.ruby-lang.org/en/ (which I think it's the 'official' Ruby
site? but I may be wrong there as well, I'm pretty new to Ruby), the
second link under 'Documents'.

Thanks again!

and have a good night everyone,
Alex
This topic is locked and can not be replied to.