Also verify the file is not used by any process

On Tue, Nov 25, 2008 at 1:40 PM, velsankar <[EMAIL PROTECTED]> wrote:

>
> Check the login user has rights to delete the file...
>
> Rgds,
> Velsankar
>
> On Nov 25, 3:14 am, Pieter Hordijk <[EMAIL PROTECTED]> wrote:
> > Hi all,
> >
> > I hope someone can help me with this cause I don't have any idea what
> > is happening... :)
> >
> > When I run following code I get the following exception "Access to the
> > path 'file.txt' is denied."
> >
> > While I am trying to get all directories in 'dir' and not files (or
> > don't I?).
> >
> >         Try
> >             For Each foundDir As String In
> > My.Computer.FileSystem.GetDirectories(dir)
> >
> >                 Dim DirProps As DirectoryInfo = New DirectoryInfo(dir)
> >
> >                 If DirProps.Name.Contains("temp") Then
> >                     My.Computer.FileSystem.DeleteDirectory(foundDir,
> > FileIO.DeleteDirectoryOption.DeleteAllContents)
> >                 End If
> >             Next
> >         Catch ex As Exception
> >             MsgBox(ex.Message)
> >         End Try
> >
> > What I am trying to do is check if 'temp' is in directory name and
> > delete the directory if it is.
> >
> > Can someone help me with this one.
> >
> > Tnx
>



-- 
My Web Site
http://everlovingyouth.googlepages.com
My Technical Blog
http://acutedeveloper.blogspot.com
Skype :santhoshnta
Orkut :everlovingyouth

Reply via email to