FileInfo.CopyTo (net 1.1)

  • Thread starter Thread starter schmidtfalko
  • Start date Start date
S

schmidtfalko

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?
 
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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top