7 Replies - 2278 Views - Last Post: 11 October 2012 - 11:54 AM Rate Topic: -----

#1 clee06  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 66
  • Joined: 01-June 10

Show a hidden folder

Posted 11 October 2012 - 07:45 AM

Hey guys, after I hide a folder, I don't know how to show it so i can delete it manually.

...
'temp_folder is the path to the folder
Dim t As New FileInfo(temp_folder)
t.Attributes = FileAttributes.Hidden
...


Is This A Good Question/Topic? 0
  • +

Replies To: Show a hidden folder

#2 torind_2000  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 52
  • View blog
  • Posts: 271
  • Joined: 22-August 11

Re: Show a hidden folder

Posted 11 October 2012 - 08:13 AM

You say manually and I think you want to delete the folder from Windows Explorer.
So to unhide the file in Windows Explorer

tools menu
folder options
view tab
show hidden file folders drives
ok
Was This Post Helpful? 0
  • +
  • -

#3 clee06  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 66
  • Joined: 01-June 10

Re: Show a hidden folder

Posted 11 October 2012 - 08:21 AM

No, what I wanted to do was to have 3 buttons (hidden directory, delete directory, and show directory). I can delete and hide my folder, but i can't get the folder to be unhidden. I want to show the folder and check to see if my files is being update. if it helps, the folder was create on my desktop.


'Delete
If (System.IO.Directory.Exists(temp_folder)) Then
            System.IO.Directory.Delete(temp_folder, True)
End If


'Hide
If (System.IO.Directory.Exists(temp_folder)) Then
            System.IO.Directory.CreateDirectory(temp_folder)
            Dim t As New FileInfo(temp_folder)
            t.Attributes = FileAttributes.Hidden
End If



This post has been edited by clee06: 11 October 2012 - 08:25 AM

Was This Post Helpful? 0
  • +
  • -

#4 torind_2000  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 52
  • View blog
  • Posts: 271
  • Joined: 22-August 11

Re: Show a hidden folder

Posted 11 October 2012 - 10:16 AM

Here's what I got just messing around.
Made three buttons on a form
Hide
Unhide
Delete

Hide Button
Spoiler

Unhide Button
Spoiler

Delete Button
Spoiler


Is this more what you're talking about?

This post has been edited by torind_2000: 11 October 2012 - 10:16 AM

Was This Post Helpful? 1
  • +
  • -

#5 clee06  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 66
  • Joined: 01-June 10

Re: Show a hidden folder

Posted 11 October 2012 - 10:36 AM

Omg, yes thank you. I was doing it right at first after all. my computer has 3 screens. The folder already unhide on my left screen. I just couldn't see it because my browser was on that screen and I was expecting it to unhide on the middle screen where everything is. Lol this forum really helps point out how big of an idiot i am, and I thank you very much!
Was This Post Helpful? 0
  • +
  • -

#6 lar3ry  Icon User is offline

  • Coding Geezer
  • member icon

Reputation: 310
  • View blog
  • Posts: 1,290
  • Joined: 12-September 12

Re: Show a hidden folder

Posted 11 October 2012 - 10:45 AM

If you have any other attributes you want to keep, you can use:
      t.Attributes = t.Attributes And Not FileAttributes.Hidden


Was This Post Helpful? 1
  • +
  • -

#7 clee06  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 66
  • Joined: 01-June 10

Re: Show a hidden folder

Posted 11 October 2012 - 11:37 AM

View Postlar3ry, on 11 October 2012 - 10:45 AM, said:

If you have any other attributes you want to keep, you can use:
      t.Attributes = t.Attributes And Not FileAttributes.Hidden



I saw that line of code while doing my research, but I didn't understand it.
Was This Post Helpful? 0
  • +
  • -

#8 lar3ry  Icon User is offline

  • Coding Geezer
  • member icon

Reputation: 310
  • View blog
  • Posts: 1,290
  • Joined: 12-September 12

Re: Show a hidden folder

Posted 11 October 2012 - 11:54 AM

File attributes are an enumeration. when you say:

t.Attributes = t.Attributes.Hidden

It's the same as saying

t.Attributes = t.Attributes And FileAttributes.Hidden

Essentially, you are turning a single bit on in the filr attributes.

Saying t.Attributes = t.Attributes And Not FileAttributes.Hidden

turns that same bit off. The good thing about this is that if you had ReadOnly turned on (for instance), this line would leave it on, and only affect the Hidden attribute.

Quote

I saw that line of code while doing my research, but I didn't understand it.


Here's the beautiful thing about programming. Provided you use test data, test directories, test files, etc., you are not going to hurt anything by trying stuff. That line of code I supplied was based on nothing more than previous experience with similar enumerators in other languages, and I really had no idea if it would work in VB.Net until I quickly tried it. I made a directory in the Debug directory of my test project, placed a Hide and an unHide button on the form, and sure enough, it worked.

Let Google, Microsoft docs, and DreamInCode be your substitute for previous experience, and don't be afraid to try things.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1