Sounds like the directory you are trying to copy to the application doesn't have access to, double check to make sure that asp.net has read/write access
--- e_throckmorton <[EMAIL PROTECTED]> wrote: > I tried that code and got the following error: > System.UnauthorizedAccessException: Access to the > path is denied. at > System.IO.__Error.WinIOError(Int32 errorCode, String > str) at > System.IO.__Error.WinIOError() at > System.IO.FileInfo.MoveTo(String > destFileName) at > readtextfile.WebForm1.MoveFile(String slocFile, > String sdesFile) in > c:\inetpub\wwwroot\readtextfile\WebForm1.aspx.vb:line > 170 > > Any ideas why? > Thanks, Eric > > > > --- In [email protected], > shannon hall > <[EMAIL PROTECTED]> wrote: > > > > > > Private Sub MoveFile(ByVal slocFile As > String, > > ByVal sdesFile As String) > > Try > > ' Create a reference to a file, > which > > might or might not exist. > > ' If it does not exist, it is not > yet > > created. > > Dim fi As New FileInfo(slocFile) > > ' Create a writer, ready to add > > entries to the file. > > > > If File.Exists(sdesFile) Then > > ' Ensure that the target file > does > > not exist, since this is disallowed. > > File.Delete(sdesFile) > > fi.MoveTo(sdesFile) > > Else > > ' Move this file to another > file. > > fi.MoveTo(sdesFile) > > End If > > > > File.Delete(slocFile) > > fi = Nothing > > Catch ex As Exception > > SendErrorMail(ex.Message) > > End Try > > > > > > End Sub > > --- Eric Throckmorton <[EMAIL PROTECTED]> > > wrote: > > > > > Hello, > > > I have a file system watcher looking for a > > > creation of new files then running some code to > use > > > that file, then deleteing it. > > > The first thing I do is copy the file to > another > > > location using the File.copy method but the > entire > > > file does not copy to the second location. > What Am > > > I doing wrong here? > > > > > > Private Sub objWatcher_FileCreated(ByVal > > > FullPath As String) Handles > objWatcher.FileCreated > > > TextBox1.Text &= "File Created: " & FullPath & > > > vbCrLf > > > path = "C:\Documents and Settings\Eric\Local > > > Settings\Application > > > > > > Data\Identities\{CD27FCB2-9E3C-45F7-BC37-93C84C481291} > \Microsoft\Outlook > > > Express\Inbox.dbx" > > > path2 = "C:\Documents and Settings\Eric\My > > > Documents\Test\filecopy.txt" > > > Try > > > ' Ensure that the target does not exist. > > > File.Delete(path2) > > > ' Copy the file. > > > File.Copy(path, path2) > > > Console.WriteLine("{0} copied to {1}", path, > > > path2) > > > ' Try to copy the same file again, which > should > > > fail. > > > File.Copy(path, path2) > > > Console.WriteLine("The second Copy operation > > > succeeded, which was not expected.") > > > Catch exp As Exception > > > Console.WriteLine("The second Copy operation > > > failed, as expected.") > > > End Try > > > 'gatherdata1() > > > End Sub > > > > > > > > > Thank-you, > > > > > > Eric > > > > > > > > > > > > --------------------------------- > > > Yahoo! Shopping > > > Find Great Deals on Holiday Gifts at Yahoo! > > > Shopping > > > > > > [Non-text portions of this message have been > > > removed] > > > > > > > > > > > > __________________________________________________ > > Do You Yahoo!? > > Tired of spam? Yahoo! Mail has the best spam > protection around > > http://mail.yahoo.com > > > > > > > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ------------------------ Yahoo! Groups Sponsor --------------------~--> Most low income households are not online. Help bridge the digital divide today! http://us.click.yahoo.com/I258zB/QnQLAA/TtwFAA/saFolB/TM --------------------------------------------------------------------~-> Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
