CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2008
    Posts
    43

    estimating time for moving files

    i have a program that can move files from one directory to another using the io.moveto function. these files are usually quite large (300MB+ videos). i was wondering if anyone knew how to show the progress of the copy in my form ie state how many bytes have been copied in a label and update it as the file is being copied. even better would be to know the transfer rate so i could estimate a time remaining. i know how to get the total size of the file

  2. #2
    Join Date
    Apr 2008
    Posts
    43

    Re: estimating time for moving files

    it would also be helpful if anyone knew how to cancel a move midway through as once i call the io.moveto function the program can't do anything else until it is finished

  3. #3
    Join Date
    Jun 2004
    Location
    Kashmir, India
    Posts
    6,808

    Re: estimating time for moving files

    Here is a nice read for you.
    http://msdn.microsoft.com/en-us/library/y32kbeb6.aspx

    You can use My.Computer.FileSystem.MoveFile method. This method has an overload which lets you show the Copy Dialog and also lets you cancel the operation.

  4. #4
    Join Date
    Mar 2007
    Location
    Argentina
    Posts
    579

    Re: estimating time for moving files

    Quote Originally Posted by johntheface
    i have a program that can move files from one directory to another using the io.moveto function. these files are usually quite large (300MB+ videos). i was wondering if anyone knew how to show the progress of the copy in my form ie state how many bytes have been copied in a label and update it as the file is being copied. even better would be to know the transfer rate so i could estimate a time remaining. i know how to get the total size of the file
    You can add a timer control to request periodically the size of the already copied file. Windows changes the size of the destiny path file meanwhile copying it.
    You can estimate the remaining time as being a constant proportional to the number of files, more another constant proportional to the remaining total added size of files.

    Although you cannot predict delays caused by other program system calls, or hard disk fragmentation.

    _

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured