Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Pause, Resume Copy of file... How (C#)?

Pause, Resume Copy of file... How (C#)?

Scheduled Pinned Locked Moved C#
csharpquestionwinformscareer
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    NeCroFire
    wrote on last edited by
    #1

    Hi I have been using Total Copy for like for ever, but I always wanted to write my own App for copying files with the same functionality. How can I pause and resume the copy of a file in C# (WinForms) as Total Copy does? I've tried Googling, but I'm not finding what I'm looking for. Thanks in advance. :)

    D 1 Reply Last reply
    0
    • N NeCroFire

      Hi I have been using Total Copy for like for ever, but I always wanted to write my own App for copying files with the same functionality. How can I pause and resume the copy of a file in C# (WinForms) as Total Copy does? I've tried Googling, but I'm not finding what I'm looking for. Thanks in advance. :)

      D Offline
      D Offline
      dan sh
      wrote on last edited by
      #2

      Use FileStream to copy the source file into the target file. When you want to pause the opration you just need to close the stream. When you want to resume, you can use seek method find last written byte and restart writing. Another way could be to have copy operation on a separate thread which can be stopped and resumed when required. I have not tried this hence not sure. Hope this helps.

      Happy Holi[^] जय हिंद

      N 1 Reply Last reply
      0
      • D dan sh

        Use FileStream to copy the source file into the target file. When you want to pause the opration you just need to close the stream. When you want to resume, you can use seek method find last written byte and restart writing. Another way could be to have copy operation on a separate thread which can be stopped and resumed when required. I have not tried this hence not sure. Hope this helps.

        Happy Holi[^] जय हिंद

        N Offline
        N Offline
        NeCroFire
        wrote on last edited by
        #3

        Thanks for the reply. Maybe binary Reader would do the job... will check it out.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups