From: "Nation, Carey" Date: 2008-03-15T01:08:22+09:00 Subject: Re: File.size? incorrect for big files? That did it! Thanks! -----Original Message----- From: Daniel Berger [mailto:djberg96@gmail.com] Sent: Thursday, March 13, 2008 3:35 PM To: ruby-talk ML Subject: Re: File.size? incorrect for big files? On Mar 13, 12:59 pm, "Nation, Carey" wrote: > Hi, > > I've written a script to monitor some files stored on our network.  The > files range from a few hundred MB to 20-50g.  Above a certain point > which I haven't really narrowed down yet, the file sizes start being > reported incorrectly from my script.  It'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.  The data type that ruby is using is perfectly capable of holding > the size of the files.  I'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