|
-
Sep 13th, 2009, 10:50 AM
#1
Thread Starter
Lively Member
Applying Attributes to multiple folders?
Hi,
how to find and change attributes of hidden folders inside a drive and make them unhide (Except Folders, say Recycler and System Volume Information)
-
Sep 13th, 2009, 05:05 PM
#2
Re: Applying Attributes to multiple folders?
you need to use a recursive dir or fso method to loop through all folders and subfolders, search in this forum, many examples
to change the attributes
vb Code:
Set fs = CreateObject("scripting.filesystemobject") Set fol = fs.getfolder(myfolder) If (fol.Attributes And vbDirectory = vbDirectory) And (fol.Attributes And vbHidden = vbHidden) Then fol.Attributes = fol.Attributes - vbHidden
this leaves all other attributes the same, just removes the hidden
setattr appears to give error with folders
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
-
Sep 13th, 2009, 05:23 PM
#3
Addicted Member
Re: Applying Attributes to multiple folders?
Or....
vb Code:
Call MkDir("C:\mydir") Call SetAttr("C:\mydir", vbHidden Or vbSystem) Call SetAttr("C:\mydir", vbNormal) Call RmDir("C:\mydir")
-
Sep 13th, 2009, 10:06 PM
#4
Re: Applying Attributes to multiple folders?
yeah i tried setattr, but it errored each time i tested with folder
that was the only reason i went to fso
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
-
Oct 31st, 2009, 06:44 AM
#5
Thread Starter
Lively Member
Re: Applying Attributes to multiple folders?
Sorry for being offline for so many days.
just logged in and trying the code. Thanx.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|