473,386 Members | 1,820 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,386 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 6609
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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,...

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.