473,563 Members | 2,635 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 2991
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
3605
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
3925
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...
2
2806
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...
16
3746
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
43415
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
7659
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7580
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...
0
7882
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7634
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...
1
5481
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5208
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...
0
3634
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...
1
2079
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
0
916
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...

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.