We have a Citrix Farm, where we have to periodically clean up a User Profile.
Here is the code..
code:
CLS
BREAK ON
'INPUT THE USERNAME - e.g. JDOE'?
'>'
GETS $name
$hm='\\SHARESERVER\Citrix_Homedir\'+$name
$pr='\\SHARESERVER\Citrix_Profiles\'+$name
;clean the home dir
IF EXIST($hm)
DIRCLEAN($hm,'\'+$filename)
ENDIF
;clean the profile
IF EXIST($pr)
DIRCLEAN($pr,'\'+$filename)
ENDIF
;build an array
$citarr='01 02 03 05 06 07 08 09'
FOR EACH $i IN Split($citarr)
$srv='\\CITRIXSERVER'+$i+'\admin$$\profiles\'
IF EXIST($srv)
DIRCLEAN($srv,$name)
ENDIF
NEXT
?
?'Process is complete - press a key'
GET $
FUNCTION DIRCLEAN($dir,$flspec)
$filename = Dir($dir+$flspec+'.*')
WHILE $filename <> '' AND $filename <> '.' AND $filename <> '..' AND @error = 0
?$dir
?$filename
$result = SetFileAttr($dir+$filename+'.*',128)
SHELL '%COMSPEC% /C RD /S /Q '+chr(34)+$dir+$filename+chr(34)
$filename = Dir() ; retrieve next file
LOOP
ENDFUNCTION
Kent
[ 10. October 2003, 19:22: Message edited by: kdyer ]