Delete a folder - Access Denied!
Posted on 2009-02-12
I am trying to write a small program users can run to delete a folder and its contents. While I have found several different ways to delete a folder, what I need is some way to get around the permissions set on the folder I am trying to delete. It works fine when I run it, but when I log in as another user I get 'Access Denied' because of course... they do not have permissions to the folder.
Without too many boring details, when users open a certain program for the first time, it pulls down its database from the server and stores it on the local machine and works from that. For some reason over time the database is becoming corrupt. If the folder and contents is deleted, the next time they log on, it will recreate the folder and the data... eliminating the problem. I do not want to make everyone admins, so I need a way around the NTFS permissions on that folder and contents so they can blow it away. Any ideas? Thanks!