# Re: FileTest.size \> 2GB?

**URL:** <https://www.ruby-forum.com/t/re-filetest-size-2gb/81462>\
**Category:** Ruby\
**Created:** [March 13, 2006, 9:47pm UTC](https://www.ruby-forum.com/t/re-filetest-size-2gb/81462 "2006-03-13T21:47:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![BergerS\_Daniel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bc8723/32.png) [@BergerS\_Daniel](https://www.ruby-forum.com/u/BergerS_Daniel)\
**Post date:** [March 13, 2006, 9:47pm UTC](https://www.ruby-forum.com/t/re-filetest-size-2gb/81462/1 "2006-03-13T21:47:22Z")

</div>

> Daniel B. wrote:
> 
> > Yes, use win32-file, available on the RAA.
> 
> Daniel, you are the hero of Ruby users on Windows.
> 
> Dave.

Heh, thanks. 🙂

The long version of this is that win32-file uses GetFileSizeEx() behind  
the scenes to get the file size instead of using the ‘size’ member of  
the File::Stat structure. I suppose I should mention that it will only  
work properly on Windows 2000 and later. Hopefully no one is still  
using Windows NT any more. It could be fixed by using \_\_int64 behind  
the scenes iirc but I haven’t looked at it in a while.

One of the things on the TODO list is to redefine the File::Stat  
structure on Windows completely (and submit a patch) because there are  
several other members that should be added (e.g. stuff you can get via  
the GetFileAttributes() function) and a few current ones that need  
fixing, e.g. ‘chardev?’. I’ve been lazy about it, in part because of  
the custom definitions of the Comparable methods such as ‘==’, which is  
a lot of annoying grunt work to implement. This might be easier,  
however, now that I’ve more or less decided to ditch C extensions in  
favor of pure Ruby Win32API packages for most (though not all) of the  
win32utils packages.

In fact, win32-file is the package I plan on reworking into pure Ruby  
form next. 🙂

Regards,

Dan
