Results 1 to 8 of 8

Thread: Hide/Unhide File Folder

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Location
    Birmingham, AL
    Posts
    1,276
    I want to Hide/Unhide a File Folder with one button click.
    Any ideas?

    Maybe later I want to password protect folder/file access also.


  2. #2
    Member
    Join Date
    Nov 2000
    Posts
    62
    You can just manipulate the files attributes to hidden.

    I like to protect my folders by running a program I wrote. The program watches the names of open windows and when it finds a match with one I have selected, it close it. i.e. I tell my program to watch for "new folder". When "new folder" or any program named that is opened, my program closes that window.

  3. #3
    Member
    Join Date
    Nov 2000
    Posts
    62
    There is a problem with using the method mentioned above. If you tell the program to watch for "new folder", then anyone can rename the folder to "new folder2" and then open it. In order to safeguard against this, you must write a function that compares the names and finds any close matches.

  4. #4
    New Member
    Join Date
    Sep 2009
    Posts
    9

    Hide/Unhide File Folder

    Dim Dir = "C:\A\"

    'Hides All The Files (Not SubFolders)
    Dim DirInfo As New IO.DirectoryInfo(Dir)
    Dim Files As IO.FileInfo() = DirInfo.GetFiles
    Dim FileName As IO.FileInfo
    For Each FileName In Files
    SetAttr(Dir & FileName.ToString, FileAttribute.Hidden)
    Next
    'Hides The Folder
    SetAttr(Dir, FileAttribute.Hidden)

    'Visual Basic 2008 Tested
    Last edited by §AE§; Oct 11th, 2009 at 08:19 PM.

  5. #5
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Hide/Unhide File Folder

    'Visual Basic 2008 Tested
    this is a vb6 forum

    vb Code:
    1. SetAttr "c:\temp\abc\", vbHidden
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  6. #6
    New Member
    Join Date
    Sep 2009
    Posts
    9

    Re: Hide/Unhide File Folder

    My bad, just trying to help

  7. #7

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Location
    Birmingham, AL
    Posts
    1,276

    Re: Hide/Unhide File Folder

    No offense, but if it had taken me 9 years to get this I would've found a new line of work
    Or just gone to a real language like C#

    (flames begin) lol

  8. #8
    New Member
    Join Date
    Sep 2009
    Posts
    9

    Re: Hide/Unhide File Folder

    I never pay attention to the dates because people take a look at these all time. Its a great thing to leave useful code on the internet for other people to copy. Especially if they understand the code and better themselves as a programmer

    Even if I post it in the wrong category

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width