Results 1 to 5 of 5

Thread: Applying Attributes to multiple folders?

Hybrid View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2006
    Posts
    89

    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)

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

    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:
    1. Set fs = CreateObject("scripting.filesystemobject")
    2. Set fol = fs.getfolder(myfolder)
    3. 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

  3. #3
    Addicted Member Xiphias3's Avatar
    Join Date
    Jan 2009
    Location
    Clarendon, Jamaica
    Posts
    188

    Re: Applying Attributes to multiple folders?

    Or....

    vb Code:
    1. Call MkDir("C:\mydir")
    2. Call SetAttr("C:\mydir", vbHidden Or vbSystem)
    3. Call SetAttr("C:\mydir", vbNormal)
    4. Call RmDir("C:\mydir")

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

    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

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jan 2006
    Posts
    89

    Smile 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
  •  



Click Here to Expand Forum to Full Width