If you say "system not find the path", it means you may not have enough privileges. You need to run your application with elevated privileges. On Windows 7 (Vista?) logging in with administrator account is not enough.
See this article for nearly all available options to run your program as administrator:
http://www.sevenforums.com/tutorials/11841-run-administrator.html[
^].
Back to deleting files, you may need to take ownership of the directory and give yourself the right to delete. See this discussion:
http://www.howtogeek.com/howto/windows-vista/how-to-delete-a-system-file-in-windows-vista/[
^].
Programmatically, you can run the commands
takeown
and
cacls
using Windows API
CreateProcess
. You can put the commands in one batch file, substitute username and directory name and run the file using
CreateProcess
.
—SA