# File#size and File#size? follow links?

**URL:** <https://www.ruby-forum.com/t/file-size-and-file-size-follow-links/93103>\
**Category:** Ruby\
**Created:** [April 27, 2007, 3:58pm UTC](https://www.ruby-forum.com/t/file-size-and-file-size-follow-links/93103 "2007-04-27T15:58:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![john\_old](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9f8e36/32.png) [@john\_old](https://www.ruby-forum.com/u/john_old)\
**Post date:** [April 27, 2007, 3:58pm UTC](https://www.ruby-forum.com/t/file-size-and-file-size-follow-links/93103/1 "2007-04-27T15:58:23Z")

</div>

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. )

---

<div class="post-metadata">

**Author:** ![john\_old](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9f8e36/32.png) [@john\_old](https://www.ruby-forum.com/u/john_old)\
**Post date:** [April 27, 2007, 4:45pm UTC](https://www.ruby-forum.com/t/file-size-and-file-size-follow-links/93103/2 "2007-04-27T16:45:27Z")

</div>

On Apr 27, 7:57 am, John J. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
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

---

<div class="post-metadata">

**Author:** ![john\_old](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9f8e36/32.png) [@john\_old](https://www.ruby-forum.com/u/john_old)\
**Post date:** [April 27, 2007, 5:11pm UTC](https://www.ruby-forum.com/t/file-size-and-file-size-follow-links/93103/3 "2007-04-27T17:11:31Z")

</div>

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

> Regards,
> 
> Dan

Thanks, Dan!
