PDA

View Full Version : ID Users and Clean Temporary Internet Files


Mythwyn
08-29-2004, 01:42 PM
I'm trying to add the function to identify all users on a Windows XP system and then add those variables to a file.delete actions.

[Example Actions]
File.Delete("C:\Documents and Settings\USER1\Local Settings\Temp", true, false, true, nil);

File.Delete("C:\Documents and Settings\USER1\Local Settings\Temporary Internet Files", true, false, true, nil);

File.Delete("C:\Documents and Settings\USER2\Local Settings\Temp", true, false, true, nil);

File.Delete("C:\Documents and Settings\USER2\Local Settings\Temporary Internet Files", true, false, true, nil);

This is a cleanup tool, the problem is the "USER1" and "USER2" are unknown variables on each system. I know how to get the users into a table with this.

USERS = Registry.GetValueNames(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\Expl orer\\DocFolderPaths");

How do I insert the user name into each File.Delete action? I've made attempts with various text outputs and String.Concat but keep running into walls no matter which way I work it.

Anyone have an ideal for a way to have [on clink] clean out Temp & Temporary Internet Files for all users on an XP system when the names are an unknown variable?

Much appreciate an insight or script.
Thanks

TJ_Tigger
08-29-2004, 03:31 PM
tblusers = {"You", "Me", "MeToo"};
for index, user in tblusers do
File.Delete("C:\\Documents and Settings\\"..user.."\\Local Settings\\Temp", true, false, true, nil);

File.Delete("C:\\Documents and Settings\\"..user.."\\Local Settings\\Temporary Internet Files", true, false, true, nil);
end


obviously you would want to get the users from the registry but that is one suggestion on how you might do it.

Mythwyn
08-29-2004, 07:45 PM
Thanks, I've good something to try now, I was'nt famiular with "for index, user in tblusers do". I'll have to search for those and do some reading.

I'll give it a try tonight. :)

TJ_Tigger
08-30-2004, 06:45 PM
Thanks, I've good something to try now, I was'nt famiular with "for index, user in tblusers do". I'll have to search for those and do some reading.

I'll give it a try tonight. :)

It is in the help guide. Look for enumerating tables using a for loop.