Hi Dw

I'm creating a program which I want to check if the normal and also a hidden folders exist or not and if exist delete it.

Im not sure how you want to accomplish this but...

you can do that by creating a console application which you pass the directory and the switches of the file attributes of the folder name as arguments. Whichever the case is.

you can clarify further by a code segment for better assistance.

I hope the idea helps you.

What I want is to get the hidden file like this:
If My.Computer.FileSystems.DirectoryExist(Dir("C:\test",VbHidden)) Then

MsgBox("Folder exist")
Else
MsgBox("No folder")
End If

But I'm using this code to get the files but it says Access Denied

Dim fFile() As String
fFile = Directory.GetDirectories("C:\", "test", SearchOption.AllDirectories.GetHashCode)

For Each FileName As String In fFile
Msg("File exist")
Next

So the last above code is the code I'm using and I can get the files with it but it fails to get the hidden directories. Sorry for not formating the codes I'm using a mobile phone.

Hi Mr. M, im using VS2013 and this code works fine whether the folder is hidden or not it'll tell you if it exists or not.

        Dim x = Microsoft.VisualBasic.FileIO.FileSystem.DirectoryExists("c:\test")
        If x = True Then
            MsgBox("Folder exist")
        Else
            MsgBox("No folder")
        End If

As simple as that, Be free to inform me if you need more help.

I hope it works for u. Thanks

commented: Thats getting a single directory, he is asking for all folders in a given directory. Was the folder even hidden? +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.