Directory.Delete method

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Brian Cahill

    #1

    Directory.Delete method

    Hi,

    I am attempting to delete Profile folders from C:\Documents and
    Settings\. I am receiving a Permission denied error when using the
    Directory.Delet e method. Here is my code. Is there any way around
    this? I am a Local Administrator on the PC where I am running the
    application. I have tried rebooting and I am not logged in as the user

    I am trying to delete. The folder is not empty and contained both
    hidden files and folders as well as read only folders. As part of my
    troubleshooting , I disabled Read only and (unhided???) all the folders.

    Thanks


    Imports System
    Imports System.IO


    Public Class Test
    Public Shared Sub Main()
    ' Specify the directories you want to manipulate.
    Dim path As String = "c:\Documen ts and Settings\ctx1"


    Try
    'This operation will not be allowed because there are
    subdirectories.
    Directory.Delet e(path, True)
    Catch e As Exception
    MsgBox(e.Messag e.ToString)
    End Try
    End Sub
    End Class

Working...