[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details

I need to set this script onto userprofile....

Asked by cahillj in MS DOS, VB Script, Microsoft Windows Operating Systems

Hi I have this code that i use on user profiles to get rid of some old cookies but I would like to run this on each user when they log out.  
So a user clicks on log off button, we run little script to clean out some files their profile.  I would like this script to run with it but I am having hard time setting the path to the user's profile path.

trying to replace this part below with code that get userprofile path and cookies folder
Const strSourceFolder = "D:\Profiles\BHS_Profiles"
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
Const intDaysToKeep = 30
Const strSourceFolder = "D:\Profiles\BHS_Profiles"
 
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")
Set objFolder = objFSO.GetFolder(strSourceFolder)
 
intDeleted = 0
intTotFound = 0
DeleteCookies strSourceFolder
 
msgbox "[" & intTotFound & "] files found. [" & intDeleted & "] files deleted"
 
Function DeleteCookies(strSourceFolder)
        For Each objFile In objFolder.Files
                intTotFound = intTotFound + 1
                If UCase(Right(objFile,5)) = "].TXT" And DateDiff("d", CDate(objFile.DateLastModified), Now) > intDaysToKeep Then
                        objFSO.DeleteFile objFile
                        intDeleted = intDeleted + 1
                End If
        Next
 
        For Each objFolder In objFolder.SubFolders
                DeleteCookies objFolder
        Next
End Function
[+][-]11/05/09 09:45 AM, ID: 25751951Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/05/09 01:08 PM, ID: 25754044Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-92 - Hierarchy / EE_QW_3_20080625