Daniel Berger
3/13/2008 7:35:00 PM
On Mar 13, 12:59=A0pm, "Nation, Carey" <Carey.Nat...@turner.com> wrote:
> Hi,
>
> I've written a script to monitor some files stored on our network. =A0The
> files range from a few hundred MB to 20-50g. =A0Above a certain point
> which I haven't really narrowed down yet, the file sizes start being
> reported incorrectly from my script. =A0It's as if the routine that does
> the system query is using a 32 bit thing for the size and it's getting
> truncated as integers do. Some files actually come back with a negative
> size. =A0The data type that ruby is using is perfectly capable of holding
> the size of the files. =A0I've tried File.size? and FileUtils.size?, so
> I'm somewhat at a loss short of writing an extension. Any ideas?
>
> The script is running on windows, querying the files via UNC paths
> through a samba share on linux.
It's a bug in Ruby.
The win32-file library fixes it.
require 'win32/file' # Do this first
File.size(some_big_file)
Regards,
Dan