Click here to Skip to main content
15,889,116 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I designed a vbscript that deletes folders from a root folder older than 180 days without any user intervention.The script deletes all the folders except the built-in folders Desktop and Documents.I get the error access denied whenever the script attempts to delete those folders.The sub-folders within the Documents and Desktop folders are deleted though.If i manually create the root folder and copy the built-in Documents and Desktop folders and manually delete the built-in folders, the task is performed successfully without any errors.

What I have tried:

Resolve vbscript not deleting built-in folders
Posted
Updated 4-Jul-18 21:55pm
v2
Comments
CHill60 5-Jul-18 3:57am    
"manually create the root folder" - how do you do that then? If you then copy Documents and Desktop then they are no longer the "built-in" folders are they.
Are you running the script as Administrator?
Why would you want to delete system folders anyway?
Richard MacCutchan 5-Jul-18 4:22am    
System folders are protected to prevent accidental deletion.
Patrice T 5-Jul-18 4:59am    
The c:\windows folder is full of files older than 180days, do you delete them too ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900