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. File is copying

File is copying

Scheduled Pinned Locked Moved C#
question
6 Posts 4 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.
  • C Offline
    C Offline
    C Scharbe
    wrote on last edited by
    #1

    how can i get to know if a file is still copying? thank you

    R 1 Reply Last reply
    0
    • C C Scharbe

      how can i get to know if a file is still copying? thank you

      R Offline
      R Offline
      Rob Philpott
      wrote on last edited by
      #2

      Surely if you call

      System.IO.File.Copy

      synchronously you'll know when it finishes when the call returns?

      Regards, Rob Philpott.

      C 1 Reply Last reply
      0
      • R Rob Philpott

        Surely if you call

        System.IO.File.Copy

        synchronously you'll know when it finishes when the call returns?

        Regards, Rob Philpott.

        C Offline
        C Offline
        C Scharbe
        wrote on last edited by
        #3

        sorry that isn't what i want because i am not the coppier. the file will be copied by someone else and i will work with the file. but i must get to know if the file was copied completely before i work with it

        T 1 Reply Last reply
        0
        • C C Scharbe

          sorry that isn't what i want because i am not the coppier. the file will be copied by someone else and i will work with the file. but i must get to know if the file was copied completely before i work with it

          T Offline
          T Offline
          The Man from U N C L E
          wrote on last edited by
          #4

          If you try the following code

          try{
          System.IO.File.OpenWrite("MyFile.txt");
          } catch (System.IO.IOException ex) {
          System.Windows.Forms.MessageBox.Show("File is locked");
          }

          This will throw an error because the file is locked if it is still copying.

          If you have knowledge, let others light their candles at it. Margaret Fuller (1810 - 1850)

          A C 2 Replies Last reply
          0
          • T The Man from U N C L E

            If you try the following code

            try{
            System.IO.File.OpenWrite("MyFile.txt");
            } catch (System.IO.IOException ex) {
            System.Windows.Forms.MessageBox.Show("File is locked");
            }

            This will throw an error because the file is locked if it is still copying.

            If you have knowledge, let others light their candles at it. Margaret Fuller (1810 - 1850)

            A Offline
            A Offline
            Aby Thomas Varghese
            wrote on last edited by
            #5

            Simple and to the point 'The Man from U.N.C.L.E.'

            Thanks and Regards, Aby

            1 Reply Last reply
            0
            • T The Man from U N C L E

              If you try the following code

              try{
              System.IO.File.OpenWrite("MyFile.txt");
              } catch (System.IO.IOException ex) {
              System.Windows.Forms.MessageBox.Show("File is locked");
              }

              This will throw an error because the file is locked if it is still copying.

              If you have knowledge, let others light their candles at it. Margaret Fuller (1810 - 1850)

              C Offline
              C Offline
              C Scharbe
              wrote on last edited by
              #6

              isn't there a possibility without throwing an exception?

              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