Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Jun 2002
    Posts
    122
    Thanks
    1
    Thanked 0 Times in 0 Posts

    VBScript Folder/File Attributes (WinXPPro/sp2)

    Hi,

    I have a situation where a file (form1.dot), that sits at our users' "C:Program FilesMGO" location is read only. I've been asked to create a .vbs file to ensure that C:Program FilesMGO and all of its subfolders and files therein are read/write, but am a bit of a novice. So far I can make sure that the MGO folder is read/write but am struggling with applying that to subfolders and files and I need to get it out fairly quickly. Can anyone help?

    Thanks in anticipation!

    Violet

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: VBScript Folder/File Attributes (WinXPPro/sp2)

    You could create a .vbs file with the following contents:
    <code>
    Dim fso
    Dim fld
    Set fso=CreateObject("Scripting.FileSystemObject")
    Set fld = fso.GetFolder("C:Program FilesMGO")
    ProcessFolder fld

    Sub ProcessFolder(AFolder)
    Dim SubFolder
    Dim AFile
    For Each AFile In AFolder.Files
    AFile.Attributes = AFile.Attributes And Not 1
    Next
    For Each SubFolder In AFolder.SubFolders
    SubFolder.Attributes = SubFolder.Attributes And Not 1
    ProcessFolder SubFolder
    Next
    End Sub
    </code>
    (1 is the value of the ReadOnly attribute)

Posting Permissions

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