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.

3 Years
Discussion Span
Last Post by fourty

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")
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")

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")
            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

Votes + Comments
Thats getting a single directory, he is asking for all folders in a given directory. Was the folder even hidden?
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.