File#size and File#size? follow links?

Discussion in 'Ruby' started by John Joyce, Apr 27, 2007.

  1. John Joyce

    John Joyce Guest

    Do File#size and File#size? follow links?
    It would certainly appear to be so, but docs don't say.
    Don't symlinks have a size of some sort of their own?
    Kind of confused by this. (Hard links are a bit more of a mind-bender
    at times. I'm afraid to create or use them for fear of black holes. )
     
    John Joyce, Apr 27, 2007
    #1
    1. Advertisements

  2. On Apr 27, 7:57 am, John Joyce <>
    wrote:
    > Do File#size and File#size? follow links?
    > It would certainly appear to be so, but docs don't say.
    > Don't symlinks have a size of some sort of their own?
    > Kind of confused by this. (Hard links are a bit more of a mind-bender
    > at times. I'm afraid to create or use them for fear of black holes. )


    Yes, it follows links. If you want to report on the size of the link
    itself, use File.lstat('link').size.

    Regards,

    Dan
     
    Daniel Berger, Apr 27, 2007
    #2
    1. Advertisements

  3. John Joyce

    John Joyce Guest

    On Apr 27, 2007, at 11:45 PM, Daniel Berger wrote:

    > On Apr 27, 7:57 am, John Joyce <>
    > wrote:
    >> Do File#size and File#size? follow links?
    >> It would certainly appear to be so, but docs don't say.
    >> Don't symlinks have a size of some sort of their own?
    >> Kind of confused by this. (Hard links are a bit more of a mind-bender
    >> at times. I'm afraid to create or use them for fear of black holes. )

    >
    > Yes, it follows links. If you want to report on the size of the link
    > itself, use File.lstat('link').size.
    >
    > Regards,
    >
    > Dan
    >
    >

    Thanks, Dan!
     
    John Joyce, Apr 27, 2007
    #3
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?ISO-8859-1?Q?=A0?=
    Replies:
    0
    Views:
    544
    =?ISO-8859-1?Q?=A0?=
    Jan 10, 2004
  2. Benny Ng
    Replies:
    0
    Views:
    415
    Benny Ng
    Jan 16, 2007
  3. JustStand
    Replies:
    2
    Views:
    528
    James Stroud
    Dec 4, 2006
  4. Abhijit D. Babar
    Replies:
    0
    Views:
    425
    Abhijit D. Babar
    May 21, 2008
  5. \Dandy\ Randy

    File Locking Follow-up

    \Dandy\ Randy, Sep 10, 2003, in forum: Perl Misc
    Replies:
    1
    Views:
    202
  6. Danny
    Replies:
    3
    Views:
    227
    Danny
    Apr 12, 2004
  7. Replies:
    3
    Views:
    234
    nolo contendere
    Apr 29, 2008
  8. Garrett Smith
    Replies:
    14
    Views:
    520
    David Mark
    May 26, 2009
Loading...