Hello Daniweb,
I am starting this thread to receive some help about a permissions problem with overwriting files when moving files to a Cleanup folder from the Desktop.
I have researched the issue and it says to modify the permissions in the app.manifest to something like: <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
But this is giving me a ClickOnce error.
My move and overwrite code is like the following:
For Each foundFile As String In My.Computer.FileSystem.GetFiles _
(My.Computer.FileSystem.SpecialDirectories.Desktop, _
FileIO.SearchOption.SearchTopLevelOnly, "*.mp3")
Try
If My.Computer.FileSystem.FileExists(foundFile) Then
My.Computer.FileSystem.MoveFile(foundFile, myPathfour & "/" & IO.Path.GetFileName(foundFile), True)
End If
Catch ex As Exception
MsgBox("Error: " & vbNewLine & "The found file: " & IO.Path.GetFileName(foundFile) & vbNewLine & "cannot overwrite its matching file in the Cleanup folder. " & vbNewLine & "You do not have sufficient permissions to overwrite the file. " & vbNewLine & "Please close the file and try again OR " & vbNewLine & "you can select the RENAME option and rename the file.")
End Try
The error that I receive while debugging when I modify the code above and take out the Try/Catch has to do with permissions for moving files.
Any help?
Thanks in advance,
m1234ike