Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Mar 2003
    Location
    Elkins Park, Pennsylvania, USA
    Posts
    325
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Can't Copy over Read-Only Folder (VBScript)

    OK, I'm in new territory here (VBScript), but I'm hoping I can get some help.

    I have a Cruzer 256mb thumb drive that I use to back up important folders. I thought I'd write a little VBScript to back up some files, but I'm getting frustrated. One of the folders that I'm copying has several sub- and sub-sub folders; other folders are only one level. It's the multi-level folder that is giving me headaches.

    I'm using very simple code, part of which I've pasted below. sFolder is the source folder, which I create using set sFolder = fso.GetFolder("Cocuments and SettingsBoonieMy DocumentsNew_Protocol"); bkDest is a simple string variable that represents the drive letter assigned to the thumb drive (in case it's not always the same drive-letter); and fso is, of course, the reference to the File System Object.

    If sFolder.DateLastModified > fso.GetFolder(bkDest & "New_Protocol").DateLastModified then
    fso.CopyFolder "Cocuments and SettingsBoonieMy DocumentsNew_Protocol", bkDest & "New_Protocol"
    fso.GetFolder(bkDest & "New_Protocol").Attributes = 0
    end if

    What happens is that, whenever I copy the folder to the thumb drive, it gets set with the "Read Only" attribute, as do all the other folders I'm backing up. But the weird thing is that, unless I turn off that attribute manually (by going into its properties), I will get a "Permission denied" error the next time I try to copy the folder to the thumb drive again. As you can see, I tried turning tha attribute off by setting the .Attributes property to 0, but that doesn't help. AND, to make matters weirder, that multi-level folder is the only folder that experiences this problem. The three or four other folders go through the exact same machinations, and THEY don't have any problems with subsequent copies.

    I'm bumming because if I have to go into the drive to change folder properties, I may as well manually copy it from there!
    <font face="Comic Sans MS">That's what you do in a herd; you look out for each other!</font face=comic> - Mike

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Can't Copy over Read-Only Folder (VBScript)

    Take a look at This Thread and see if it helps.

    Andrew C

  3. #3
    3 Star Lounger
    Join Date
    Mar 2003
    Location
    Elkins Park, Pennsylvania, USA
    Posts
    325
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Can't Copy over Read-Only Folder (VBScript)

    No luck. And I'm getting more confused. Here are some things I noticed:

    - Using the ATTRIB command at the DOS prompt doesn't do the trick. It doesn't even show that folder as being Read-Only.

    - If I go to the parent folder, its properties indicate that it too is Read-Only. I right-click on the parent folder and go to its Properties, I uncheck "Read Only" and, at the next prompt, tell it to cascade those changes through all folders and files. I check the New_Protocol folder (the one giving me grief!) and it still indicates that it's protected!

    - The only way I have successfully turned that property off is to manually do it from its Properties dialog box.

    I'm at a total loss...
    <font face="Comic Sans MS">That's what you do in a herd; you look out for each other!</font face=comic> - Mike

  4. #4
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Can't Copy over Read-Only Folder (VBScript)

    Windows XP always shows Folders as being ReadOnly. This is because you are not supposed to directly manipulate the Folder using normal applications. The NTFS file system updates folders itself.

    StuartR

Posting Permissions

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