473,700 Members | 2,725 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to calc easier the "long" filesize from nFileSizeLow andnFileSizeHig h

Hi !

I get the file datas with FindFilesW.
I want to calc the filesize from nFileSizeLow and nFileSizeHigh with
easiest as possible, without again calling os.getsize().
How to I do it ? I need good result !

Thanx for help:
dd
May 29 '06 #1
4 2999
On 30/05/2006 1:40 AM, DurumDara wrote:
Hi !

I get the file datas with FindFilesW.
I want to calc the filesize from nFileSizeLow and nFileSizeHigh with
easiest as possible, without again calling os.getsize().
How to I do it ? I need good result !

Thanx for help:
dd


Hello, *again*, dd

Well I've never heard of this caper before but what I'd do would be a
Google search for e.g. nFileSizeHigh and read the first few articles ...
in particular the first one which warns about bulldust on the MS website :-)

HTH,
John

P.S. You have heard of Google, haven't you?
May 30 '06 #2
On 30/05/2006 1:40 AM, DurumDara wrote:
Hi !

I get the file datas with FindFilesW.
I want to calc the filesize from nFileSizeLow and nFileSizeHigh with
easiest as possible, without again calling os.getsize().
How to I do it ? I need good result !

Thanx for help:
dd


Hello, *again*, dd

Well I've never heard of this caper before but what I'd do would be a
Google search for e.g. nFileSizeHigh and read the first few articles ...
in particular the first one which warns about bulldust on the MS website :-)

HTH,
John

P.S. You have heard of Google, haven't you?
May 30 '06 #3
Shift nFileSizeHigh by 32 and add FileSizeLow.

Roger

"DurumDara" <du*******@gmai l.com> wrote in message news:ma******** *************** *************** *@python.org...
Hi !

I get the file datas with FindFilesW.
I want to calc the filesize from nFileSizeLow and nFileSizeHigh with easiest as possible, without again calling os.getsize().
How to I do it ? I need good result !

Thanx for help:
dd



----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---
May 30 '06 #4
On 30/05/2006 1:55 PM, Roger Upole *top-posted*:
Shift nFileSizeHigh by 32 and add FileSizeLow.
Uh-ohh. Here we have yet another manifestation of the Y2K bug's little
sibling, the F2G bug.

The above doesn't work for 2GB <= filesize < 4GB, 6GB <= filesize < 8GB,
etc. See below.

Roger

"DurumDara" <du*******@gmai l.com> wrote in message news:ma******** *************** *************** *@python.org...
Hi !

I get the file datas with FindFilesW.
I want to calc the filesize from nFileSizeLow and nFileSizeHigh with easiest as possible, without again calling os.getsize().
How to I do it ? I need good result !

Thanx for help:
dd


Those two items are defined as int (that's *signed* int) -- so if the
punter has a 3 GB file, nFileSizeHigh will be zero and nFileSizeLow will
be -1073741824. *Minus* 1 GB? Hey, d00d, who stole my file-system?

Try this:

fsz = (hi << 32) + lo
if lo < 0:
fsz += 0x100000000

This problem is described in the first article found by googling for
"nFileSizeHigh" , as I suggested to the OP. Here is some evidence:

C:\junk>dir gb3.txt
[snip]
31/05/2006 07:59 AM 3,221,225,472 gb3.txt
[snip]
C:\junk>python
Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright" , "credits" or "license" for more information.
|>>> import win32file
|>>> d = win32file.FindF ilesW(u'gb3.txt ')
|>>> d
[(32, <PyTime:30/05/2006 9:43:06 PM>, <PyTime:30/05/2006 9:59:06 PM>,
<PyTime:30/05/2006 9:59:06 PM>, 0, -1073741824, 0, 0, u'gb3.txt', u'')]
|>>> hi, lo = d[0][4:6]
|>>> hi, lo
(0, -1073741824)
|>>> fsz = (hi << 32) + lo
|>>> fsz
-1073741824
|>>> # if lo < 0:
|... fsz += (1 << 32)
|>>>
|>>> fsz
3221225472L
|>>>

Cheers,
John

May 30 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3624
by: Num | last post by:
Hi all, I have to convert a J2EE date as a long ("Millis") in a .NET date as a long ("Ticks") In Java, currentTimeMillis, is the difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC. In .NET, DateTime.Ticks is the 100-nanosecond intervals that have
17
3939
by: Adam Ierymenko | last post by:
I have a question that might have been asked before, but I have not been able to find anything via groups.google.com or any web search that is definative. I am writing an evolutionary AI application in C++. I want to use 32-bit integers, and I want the application to be able to save it's state in a portable fashion. The obvious choice would be to use the "long" type, as it is deined to be at least 32 bits in size. However, the...
2
2816
by: Michael S. Montoya | last post by:
I have a report which has 3 sub-reports in the detail section. Everything (subforms, detail section) is set to Can Grow and Can Shrink as True. I have one record in which one of the subforms has about 7 detail items and the other subforms have several detail items. When I try and print this record it does not get past "Formating - Hit Control-Break" in the status line. When I delete a couple of the 7 line items, it prints fine. Is...
16
3771
by: ondekoza | last post by:
Hello, I need to convert the string "FFFFFFFF" to a long. To convert this string I tried the following: >>> 0xffffffff -1 >>> 0xffffffffL 4294967295L OK, this is what I want, so I tried
12
43443
by: Zero | last post by:
Hi everybody, i want to write a small program, which shows me the biggest and smallest number in dependance of the data type. For int the command could be: printf("\n%20s\t%7u\t%13i\t%13i","signed int",sizeof(signed int),INT_MIN,INT_MAX);
0
8638
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9058
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8952
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8909
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7791
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5894
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4395
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3081
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2018
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.