Recently i had to delete a lot of temporary folders on a large number of domain computers. A GPO had caused a number of folders to be created in the root of C each time a user logged onto a computer. After having sorted the GPO i had to find a way to delete all the folders again. The tricky part was that the folders had different owners and thus different permissions assigned so they could not all be deleted by the current user.
Microsofts command-line tool SubInACL proved to be exactly the tool for the job and i could easily make a vbs script which could do the cleanup job for me at logon – no matter who was logged on.
I simply used SubInACL to give the current user Full Access to all the folders and their subfolders and files by looping through the folder structure and subsequently deleting the folders which matched my deleting criteria.
The syntax i used to give the current user full access a folder and its subfolders and files was this:
subinacl.exe /verbose=1 /subdirectories c:\folder\*.* /grant=Current user=F
Recent Comments