I have 2 problems which I think are related and need some help with. I am writing a small program to clean some temp directories.
1) I get the following error when I run this code anywhere in my program
System.IO.Directory.GetFiles("C:\Users\xxx\AppData\Local\Microsoft\Windows\Temporary Internet Files\")
DirectoryNotFoundException was unhandled
Could not find a part of the path 'C:\Users\xxx\AppData\Local\Local\Microsoft\Windows\Temporary Internet Files'.
Basically I am trying to clean the temporary internet files folder. I am assuming that because it is a hidden folder the program cannot see it.
2) My program is getting the following error when attempting to delete the files
Access to the path 'C:\Users\xxx\AppData\Local\Temp\test.txt' is denied.
Wierd thing is that 98% of the files in this directory it will delete but has a problem with a few. (It is not because they are in use). The current user can manual delete this file with no problems but the program cannot. It seems as though it is a permission problem but I am not sure why. I have tried adding everyone with full control to the file and the file still cannot be deleted. I am currently running on vista.
Thanks for the help.