From: Park Heesob Date: 2006-11-02T15:11:05+09:00 Subject: Re: file size revisit Hi, >From: python152@gmail.com >Reply-To: ruby-talk@ruby-lang.org >To: ruby-talk@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 > >-Oliver > > As 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/