By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,795 Members | 1,235 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,795 IT Pros & Developers. It's quick & easy.

FileInfo.CopyTo (net 1.1)

P: n/a
Hi,

i use the CopyTo - Function to copy large files into a net drive. Now
it would be mad, if I could indicate the remaining time or also the
status (in %) to the copying action. Have unfortunately still nothing
found... Is there a possibility?

Feb 22 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi,

There is no way to know the exact time left, but there are ways to simulate it.
1) Keep track of the starting time and the total number of files to copy.
2) After each copied file, find out the average time of total files copied
3) Using the average time, multiply by number of files left to copy
4) Display the calculate the estimated end time and display it in a Label or similar
5) Call Application.DoEvents() to force a GUI update.

A better estimate would be found with total number of bytes copied and total number of bytes left.

An event better estimate would be to scrap CopyTo and handle your own copying using a Stream. This way lets you update the time in the middle of copying a single file.

Also consider putting the copying part in its own Thread to keep the GUI responsive.

Good Luck!
On Thu, 22 Feb 2007 17:17:16 +0100, <sc**********@t-online.dewrote:
Hi,

i use the CopyTo - Function to copy large files into a net drive. Now
it would be mad, if I could indicate the remaining time or also the
status (in %) to the copying action. Have unfortunately still nothing
found... Is there a possibility?



--
Happy coding!
Morten Wennevik [C# MVP]
Feb 22 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.