System.IO.File.Copy not copying and no error

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Re: System.IO.File.Copy not copying and no error

    I'd suggest wrapping the copy in a Try/Catch block just to be sure. Then
    throw a new exception, outputing your source/destination paths along with
    the original exception:

    Try
    System.IO.File.Copy(Source,Dest)
    Catch ex as exception
    throw new Exception("Source: '" & source & "' - Dest: '" & dest &
    "'",ex)
    end try

    also, put a break point at the Throw, and examine your variables.



    "Xander Q." <xander_q@hotmail.com> wrote in message
    news:1958ff15.0307052341.260d3083@posting.google.c om...
    > Something really strange is happening. i'm using the following code to
    > copy a file. this worked on my development machine, but when i moved
    > it to the server (win2k) it is not copying the file and not generating
    > an error. it just merrily goes on.
    >
    > --------------------------------------------------------------------
    > source= Server.MapPath("/TTClaimsForm2/Reports/xxx.doc")
    > dest= Server.MapPath("/TTClaimsForm2/Reports/Temp/xxx.doc")
    >
    > System.IO.File.Copy(source, dest)
    > --------------------------------------------------------------------
    >
    >
    > i checked the value of dest and it's correct. i replaced it with an
    > empty string and it gave an error as expected.
    >
    > BUT i noticed that if i hard code destination like this:
    > System.IO.File.Copy(source,
    > "C:\inetpub\wwwroot\ttclaimsform2\Temp\xxx.doc ") then the copy works.
    >
    > how can this be happening?

    David Waz... Guest

  2. Similar Questions and Discussions

    1. network or file system error
      Contribute encountered a network or file system error. Please try the operation again, and contact the administrator if the error continues to...
    2. System.IO.FileNotFoundException using file.copy
      I am trying to copy a file to a network drive. I can do it on the domain controller/web server but not from a client. Here is the code: Dim...
    3. Copying system drive to another one so that it could be used as a boot disk
      When I bought my Mac, 10 GB was all you needed. Now, it's barely sufficient to write an e-mail. I bought a 120 GB drive and want to copy the...
    4. HELP: Copying DVD'S with copy guard to my drive (MAC)
      Greetings all I am new to MAC, Finally came to my senses. I am presently trying to figure out how to copy some of my dvd's with copy protection on...
    5. File Copy Error To My Network Places
      Hello, I'm sorry to waist your time with this, but I can't figure this one out. I was hoping someone could help me. I have set-up a Network...
  3. #2

    Default Re: System.IO.File.Copy not copying and no error

    "David Waz..." <dlw@pickpro.com> wrote in message news:<bhZNa.1682$Ro2.1449@newssvr31.news.prodigy.c om>...
    > I'd suggest wrapping the copy in a Try/Catch block just to be sure. Then
    > throw a new exception, outputing your source/destination paths along with
    > the original exception:

    ah yes i neglected to mention that i already did that, and the value
    of 'dest' is correct. it is the same as the hard-coded string and yet
    it fails...

    damn i hate this stuff!!!

    but thx for the input...
    Xander Q. Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139