Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

VB 2008 File/Folder Hider


Cybernaught's Avatar
Member
0 0

I have been building a program for myself, to hide files and folders using the "attrib file/folder +r +a +s +h" and the program will unhide the files too, but, I cant figure out how to get the program to search for the files that I have hidden with this method, I have to manually enter the path and file name to unhide them.

I am using a generic browse button that allows me to browse the files on my computer, but the browse feature obviously doesn't search hidden files. Is there a way to make it search those hidden files?

If not, is there anyway to save entered text from the box where I hid the file, so that I can retrieve it, or have it come up as recent text entered so that I don't even have to go find what I've already hidden?

Any ideas that anyone has, or questions about what I'm trying to explain, would be greatly appreciated! Thanks in advance for your help!


Cybernaught's Avatar
Member
0 0

Thank you for the reply.

That link you gave me was a big help, it has put me back on the track, but I'm still not moving… Here is the code I have so far, and what it's doing:

Dim myDirectory As DirectoryInfo myDirectory = New DirectoryInfo("C:\users\me\desktop\" )

    Dim aFile As FileInfo
    For Each aFile In myDirectory.GetFiles
        If (aFile.Attributes And FileAttributes.Hidden) = (FileAttributes.Hidden And FileAttributes.System And FileAttributes.ReadOnly And FileAttributes.Archive) Then
            Form4.TextBox1.Text = aFile.FullName
        End If
    Next

This is only finding one file at any time. I have Form4.TextBox1 set as a multiline box with scroll bars even, but it only finds one file and it's not even a hidden file, it's a text file that is visible and accessible on my desktop, the file also starts with a Z, when I change the name of the file, it chooses a file that starts with an X which is also, not hidden and it's a shortcut icon. I think that it's only printing the last file it finds and replacing the ones before it before I get a chance to see them and it's not even showing the last hidden file… Any ideas?