tosmserversupport
asked on
I need some help with a Directory.delete problem.
I have created a C# Console application that automatically goes into a folder and cleans up some subfolders. When running the script it works fine for the most part. but on certain folders. i get the following error:
Access to path '<drive>:\users\<users folder>\<subfolder>' is denied.
I have checked my permisions on the files/folders and on all of them i have full permissions for all files, folders, and subfolders. so why am i getting this message? any help would be appreciated.
Access to path '<drive>:\users\<users folder>\<subfolder>' is denied.
I have checked my permisions on the files/folders and on all of them i have full permissions for all files, folders, and subfolders. so why am i getting this message? any help would be appreciated.
System.IO.Directory.Delete(path_to_delete, true);
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You may be opening the folder by the Explorer
ASKER
thank you for your help. it appears that there is a process running on the server which is preventing it from being deleted.
ASKER
Thanks everyone for their prompt reply. it seems a program is accessing the files while i am attempting to delete them. I will write some code to remove these locks before deleteing the folders.
Did I answer your question fully? I am just wondering why you gave the grade of "B". Usually you give the grade B when your answer was not answered fully
ASKER