From: Oliver Date: 2006-11-02T23:50:17+09:00 Subject: Re: file size revisit Hi Park - thanks for the suggestion. With this redefined function, it works fine on windows now. why it is not the case with win32/file, and how can I make it work cross the platform? Regards, -Oliver On Nov 2, 1:11 am, "Park Heesob" wrote: > Hi, > > > > >From: python...@gmail.com > >Reply-To: ruby-t...@ruby-lang.org > >To: ruby-t...@ruby-lang.org (ruby-talk ML) > >Subject: file size revisit > >Date: Thu, 2 Nov 2006 10:40:06 +0900 > > >Hi, folks > > >the subject has been reported before, basically, ruby File.size() won't > >work properly on windows when file size exceed certain limit (2GB > >maybe). One workaround is to require win32/file. Yes, this will get you > >correct file, however, this will break the code (in my case, the find > >module) ... the previous recursive scan of file system stop > >functioning. The question is, is there a more "generic" or "elegant" > >way of getting correct file size on both *nix and windows? > > >thanks > > >-OliverAs the another workaround in windows, try this: > > require 'Win32API' > def File.size(name) > buf = "\0"*36 > Win32API.new('kernel32','GetFileAttributesEx','PLP','L').call(name,0,buf) > (buf[28,4].unpack("L").first << 32) + buf[32,4].unpack("L").first > end > > Regards, > > Park Heesob > > _________________________________________________________________ > Express yourself instantly with MSN Messenger! Download today it's FREE!http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/