469,575 Members | 1,613 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,575 developers. It's quick & easy.

Unable to delete Temporary Internet File folder

Alright, here it is I am trying to write a win32 app in VB 2005 to clean up user's profiles. everything works correctly except for the Delete("directory", True) statement. I get a System.IO.DirectoryNotFoundException: Could not find a part of the path. Then it gives me a random file name from the UserProfile\Local Settings\Temporary Internet Files\Content.IE5\SomeRandomFolder. This is absolutley driving me nuts. So I am gonn give you a basic Pseudo outline, just let me know if you need to see actual code.

1.) User provide the administrator's password, and then the administrator is authenticated against the Active Directory using the provided password.

2.) If authentication is successful another text field is provided to enter the name of the profile to clean i.e. jsmith then after a name is entered a list of computers on the domain is populated.

3.)The user selects multiple PCs from the list and the program runs through each one of the computers in the list and does the following:

a.) pings the computer to see if it is powered on or available if it is the loop is continued, if not the loop restarts with the next PC in the list.

b.) The next step checks the given computer i.e. \\computer name\c$\Documents and Settings\ for that particular user's profile folder.

c.) If the profile is found the code loops through each file in the directory and sets the attributes to vbNormal.

d.) The code then loops through each directory (and sub directory) found in the folder and sets the directories and sub directories attributes to vbNormal.

e.) After the attributes are set the directory is deleted (or at least the program attempts to delete the directory) using Directory.Delete("directory to delete", true) statement.

And that is where I run into trouble, the exception gets caught and throws it out to a dialog box and the program stops. When i go back and check the directory that is supposed to be deleted everything is deleted except for of course the user directory itself and the \Local Settings\Temporary Internet Files\Content.IE5 folder and files within those folders. I have tried everything that I can think of, I am logged in as a network administrator on my machine, I have logged onto my machine using the administrator account and run this program and it still does not work. I can delete the files manually through the file explorer and I have checked the permissions on the folders and files and the attributes all are set as they should be (the files or folders are not marked as read only as they were before i started the program so the set attributes is working the way it should, or at least it appears to be working the way it should). I can't think of anything else, so any help would be appreciated and please keep in mind that the last time I messed with Basic there was nothing Visual about it so talk to me as though I'm attending a 101 class.

Thanks in advance,

James T
Heartland, USA
Feb 12 '08 #1
0 2679

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Rajiv Das | last post: by
1 post views Thread by Manish | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.