OK.. Here is something that I have been fumbling around with -

Requires the following UDFs:
WSHPIPE()
DATECALC()
LOGGER()
MAILER()

 CLS

BREAK ON
IF EXIST('H:\Profileremove.csv') DEL 'H:\Profileremove.csv' ENDIF
FOR EACH $i IN Split('01 03')
$loc='\\CITRIX'+$i+'\admin$$\profiles\'
$rc=WshPipe('%comspec% /c dir '+$loc+'*.*',1)
FOR EACH $line IN $rc
IF NOT instr($line, 'File Not Found')
;?$line
; -- Convert American Dates to European format
$dtchk=split(split($line)[0],'/')[2]+'/'+split(split($line)[0],'/')[0]+'/'+split(split($line)[0],'/')[1]
;?$dtchk
$name=split($line)[17]
$dt=DATECALC($dtchk,@date)
IF val($dt)>2 AND len($name)>3 AND $name<>'All Users' AND $name<>'DEFAULT'
?'Days ago: '+$dt
?$loc+$name
;SHELL '%COMSPEC% /C RD /S /Q '+chr(34)+$loc+'\'+$name+chr(34)
If @error<>$err=1 ELSE $err=0 ENDIF
$logdata='Days ago: '+$dt+','+$loc+$name+','+$err
LOGGER('H:\Profileremove.csv',$logdata+@crlf)
ENDIF
ENDIF
NEXT
NEXT
MAILER('recipient@@company.com','Profiles remove Log','Removal Log','H:\Profileremove.csv')


Thanks,

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's