473,432 Members | 1,373 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,432 software developers and data experts.

Monitoring File Size

Hi,

How can I monitor the file size of a file which is still copying? If I've
used FileInfo.Length, it'll return the final file size, not the intermediate
one. Thanks.

Regards,
Curtis Kam
Nov 16 '05 #1
3 6610
FileInfo.Length will return the size of the file. The problem is that using
Explorer to copy a file (well, I guess it's probably the CopyFile API in
Windows) will cause the entire file to be allocated on disk and then the
data is transferred.

So, the result from FileInfo.Length depends on the application that copies
the file. You can see this by monitoring a file you're downloading using the
ftp command prompt tool which allocates the size as it is receiving data
FileInfo.Length would give you the true instant size.

Arild

"Curtis Kam" <lu*****@hongkong.com> wrote in message
news:O$*************@tk2msftngp13.phx.gbl...
Hi,

How can I monitor the file size of a file which is still copying? If I've
used FileInfo.Length, it'll return the final file size, not the
intermediate
one. Thanks.

Regards,
Curtis Kam

Nov 16 '05 #2
Btw... if this is your own application that you want to monitor filecopying
in then you should look at the CopyFileEx API which provides callback
functionality to keep track of the progress.
Arild

"Arild Bakken" <ar*****@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
FileInfo.Length will return the size of the file. The problem is that
using Explorer to copy a file (well, I guess it's probably the CopyFile
API in Windows) will cause the entire file to be allocated on disk and
then the data is transferred.

So, the result from FileInfo.Length depends on the application that copies
the file. You can see this by monitoring a file you're downloading using
the ftp command prompt tool which allocates the size as it is receiving
data FileInfo.Length would give you the true instant size.

Arild

"Curtis Kam" <lu*****@hongkong.com> wrote in message
news:O$*************@tk2msftngp13.phx.gbl...
Hi,

How can I monitor the file size of a file which is still copying? If I've
used FileInfo.Length, it'll return the final file size, not the
intermediate
one. Thanks.

Regards,
Curtis Kam


Nov 16 '05 #3
Thanks,

I'm now using the FileStream object to read the file and write it byte by
byte, so I can know exactly the bytes that it's copied.

Regards,
Curtis Kam

"Arild Bakken" <ar*****@hotmail.com> wrote in message
news:ey****************@TK2MSFTNGP11.phx.gbl...
Btw... if this is your own application that you want to monitor filecopying in then you should look at the CopyFileEx API which provides callback
functionality to keep track of the progress.
Arild

"Arild Bakken" <ar*****@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
FileInfo.Length will return the size of the file. The problem is that
using Explorer to copy a file (well, I guess it's probably the CopyFile
API in Windows) will cause the entire file to be allocated on disk and
then the data is transferred.

So, the result from FileInfo.Length depends on the application that copies the file. You can see this by monitoring a file you're downloading using
the ftp command prompt tool which allocates the size as it is receiving
data FileInfo.Length would give you the true instant size.

Arild

"Curtis Kam" <lu*****@hongkong.com> wrote in message
news:O$*************@tk2msftngp13.phx.gbl...
Hi,

How can I monitor the file size of a file which is still copying? If I've used FileInfo.Length, it'll return the final file size, not the
intermediate
one. Thanks.

Regards,
Curtis Kam



Nov 16 '05 #4

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

Similar topics

1
by: Ron | last post by:
I am trying to run asp.net pages. The server is accessed via http://sitename/username I have verified it is using port 80 and aspx extensions are configured. But when I run and asp.net page I...
1
by: robin9876 | last post by:
I am looking to automate monitoring space used for each file in each database on a SQL Server 2000. Does anybody have any SQL Scripts to do this or to find the space used?
4
by: johnm | last post by:
Hello, We currently are running a CRM application that uses DB/2 7.2 for the data repository. We will be upgrading to 8.2 later this year....maybe....time and resources permitting. The...
0
by: Jeff Reed | last post by:
I am experiencing the the problem outlined the below. Unfortunately, I am using WinXP and I not sure if I can apply the solution due to lack of security control Any feed back would be apreciated ...
1
by: Edward Yang | last post by:
I setup web.config with impersonation="true". On our local server the project works great. I did the same procedures on our staging server, but it failed with an impossible error: Server Error in...
0
by: Ron Simpson | last post by:
I am trying to run asp.net pages. The server is accessed via http://sitename/username I have verified it is using port 80 and aspx extensions are configured. But when I run and asp.net page I...
9
by: Tim D | last post by:
Hi, I originally posted this as a reply to a rather old thread in dotnet.framework.general and didn't get any response. I thought it might be more relevant here; anyone got any ideas? My...
5
by: Joe | last post by:
I'm getting the following error when trying to call a page on a secure server. I'm not doing any impersonations or file access of any kind. The page is using PayPal and I'm wondering if PayPal has...
1
by: William Connery | last post by:
Hi, I have a small python program with e-mail capabilities that I have pieced together from code snippets found on the internet. The program uses the smtplib module to successfully send an...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
0
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...
0
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...
0
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...

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.