Permission denied deleting a folder using VBScript 
Author Message
 Permission denied deleting a folder using VBScript

Hi, I wrote this little script to delete a directory every Friday that contains a bunch of junk (files and folders posted by users). The code bellow seems to work in testing. When I run it against a folder that contains a read only file or a folder that my account doesn't have permissions to it returns an Permission Denied error.

How can I use a script to delete a directory full of other directories and files, some of which I won't have permissions to and some of which will be read only? I have administrator rights on the Windows 2000 Server...

Here's part of my script:

Set oFso = CreateObject("Scripting.FileSystemObject")
oFso.DeleteFolder("d:\xgigo"), 1

Thanks...



Mon, 10 Oct 2005 06:19:22 GMT  
 Permission denied deleting a folder using VBScript

you should run the script as the administor.  If it is a shared network drive, just run it from the server.  If not, create an icon on your desktop.  In properties add wscript in the target before the location of the script.  Then run the script by right mouse clicking and click runas.  That way you can run as an administrator.  Or at least that is what I have been told by others.

  Hi, I wrote this little script to delete a directory every Friday that contains a bunch of junk (files and folders posted by users). The code bellow seems to work in testing. When I run it against a folder that contains a read only file or a folder that my account doesn't have permissions to it returns an Permission Denied error.

  How can I use a script to delete a directory full of other directories and files, some of which I won't have permissions to and some of which will be read only? I have administrator rights on the Windows 2000 Server...

  Here's part of my script:

  Set oFso = CreateObject("Scripting.FileSystemObject")
  oFso.DeleteFolder("d:\xgigo"), 1

  Thanks...



Mon, 10 Oct 2005 20:38:11 GMT  
 Permission denied deleting a folder using VBScript
Did anybody ever figure this out?
Because I had the same problem.
I ran a script and I was logged in as administrator.
Why can you not delete or move if you are admin?

Quote:
>-----Original Message-----
>you should run the script as the administor.  If it is a

shared network drive, just run it from the server.  If
not, create an icon on your desktop.  In properties add
wscript in the target before the location of the script.  
Then run the script by right mouse clicking and click
runas.  That way you can run as an administrator.  Or at
least that is what I have been told by others.

Quote:
>  Hi, I wrote this little script to delete a directory

every Friday that contains a bunch of junk (files and
folders posted by users). The code bellow seems to work in
testing. When I run it against a folder that contains a
read only file or a folder that my account doesn't have
permissions to it returns an Permission Denied error.
Quote:

>  How can I use a script to delete a directory full of

other directories and files, some of which I won't have
permissions to and some of which will be read only? I have
administrator rights on the Windows 2000 Server...
Quote:

>  Here's part of my script:

>  Set oFso = CreateObject("Scripting.FileSystemObject")
>  oFso.DeleteFolder("d:\xgigo"), 1

>  Thanks...



Tue, 11 Oct 2005 22:50:49 GMT  
 Permission denied deleting a folder using VBScript
http://www.sloppycode.net/fso/?m=57

show:

fso.DeleteFolder FolderSpec:="C:\MyDocuments", Force:=True

Although I think that can be done as:

fso.DeleteFolder "C:\MyDocuments", True

as opposed to using the named arguments (which I've never used in VBScript).

Chris,

Did anybody ever figure this out?
Because I had the same problem.
I ran a script and I was logged in as administrator.
Why can you not delete or move if you are admin?

Quote:
>-----Original Message-----
>you should run the script as the administor.  If it is a

shared network drive, just run it from the server.  If
not, create an icon on your desktop.  In properties add
wscript in the target before the location of the script.
Then run the script by right mouse clicking and click
runas.  That way you can run as an administrator.  Or at
least that is what I have been told by others.

Quote:
>  Hi, I wrote this little script to delete a directory

every Friday that contains a bunch of junk (files and
folders posted by users). The code bellow seems to work in
testing. When I run it against a folder that contains a
read only file or a folder that my account doesn't have
permissions to it returns an Permission Denied error.
Quote:

>  How can I use a script to delete a directory full of

other directories and files, some of which I won't have
permissions to and some of which will be read only? I have
administrator rights on the Windows 2000 Server...
Quote:

>  Here's part of my script:

>  Set oFso = CreateObject("Scripting.FileSystemObject")
>  oFso.DeleteFolder("d:\xgigo"), 1

>  Thanks...



Tue, 11 Oct 2005 23:18:47 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. deleting files with file system object ( Permission denied error )

2. Permission Denied while deleting Registry Keys

3. Using VBScript to set permissions on a folder

4. Changing file / folder permissions using VBScript

5. Permission Denied when copying a file to the SendTo folder

6. SetReportVariableValue returns Permission Denied (Microsoft VBScript runtime (0x800A0046))

7. Using FSO, permission denied

8. Permission denied when using MsgBox

9. Permission denied when using Input boxes and message boxes

10. Permission Denied error when using InputBox

11. Getting Permission Denied error, using FSO.Copy or InUse.exe

12. 800a0046 - Permission Denied Using InternetTransfer Protocol

 

 
Powered by phpBB® Forum Software