I'm not a programmer, so bare that in mind please

I wrote a program that deletes incremental backups directories past a certain number of days. but it partly uses someone else code (KILLTREE) that I can't rewrite yet. Does anyone have something that is simpler (deletes dir & files /w readonly attribs too) and that I can use freely? Here is my program that uses KILLTREE, I want to replace KILLTREE with something simplier:
I tried SysFileTree() and parsing the result, but kind of ended up deleting everything with that

/* load the functions from the DLL REXXUTIL */
call rxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'
call SysLoadFuncs
CurrentDir = directory()
/* get todays date in base format */
Today=date('B')
Weekday=date('W')
/* number of days to backup */
NumDays = 14
/* calulates days to keep backed up */
LastWeek=Today-Numdays
say 'Today:' rxdates(today 'F') 'is 'rxdates(today 'W') ' -- ' NumDays 'days ago: 'rxdates(lastweek 'U') 'was a 'rxdates(lastweek 'W')
say ''
say ''
say 'This will keep incremental backups for the past ' || NumDays 'days.'
say ''
say 'And will delete any older backups past: '
say rxdates(lastweek 'F') || ' in the directory ' || CurrentDir || '\' || Weekday
say ''
say 'Do you want to continue y/n'
pull YesNo
if \ ((YesNo = "Y") | (YesNo = "y")) then exit
/* calulates the name of the weekday */
Weekday=rxdates(lastweek 'W')
/* delete cetain number of days back */
deleteDays = 90
/* dirToDelete contains the name of the directory */
/* to delete */
do deleteDays
LastWeek = LastWeek -1
/* calulates dirToDelete's name */
DateString = rxdates( LastWeek 'U')
Year = SubStr(DateString,7,2)
Month = SubStr(DateString,1,2)
Day = SubStr(DateString,4,2)
/* StandardDate = yyyymmdd */
StandardDate = '20' || Year || Month || Day
/* delete the directory tree */
say 'Deleting...'
dirToDelete = CurrentDir || '\' || Weekday || '\' || StandardDate
DelSuccess = killtree(dirToDelete)
end
And here is the KILLTREE that I'm using. Does anyone have something simpler that I can use?
/*
* REXXIT VERSION: 96.299a
* PROCESSED AT : Tue May 05 1998 08:45:54PM
* SOURCE : E:\DB\PROJECTS\OS2\KILLTREE\KILLTREE.X
* DESTINATION : .\OUT\KILLTREE.CMD
*/
/* @ START FILE: E:\DB\PROJECTS\OS2\KILLTREE\KILLTREE.X (Tue May 05 1998 08:45:50PM) */
ColorError = '[0;1;31m';
ColorHighlight = '[0;1;33m';
ColorNormal = '[0;32m';
ColorReset = '[0m';
AddRc = RxFuncAdd('SysFileTree', 'RexxUtil', 'SysFileTree');
call charout ,ColorHighlight;
say "[]--------------------------------------------------------------[]";
say "| KILLTREE.CMD, Version 98.125 (C)opyright by Dennis Bareis 1993 |";
say "| http://www.ozemail.com.au/~dbareis (db0@anz.com) |";
say "[]--------------------------------------------------------------[]";
say "";
call charout ,ColorReset;
Arguments = arg(1);
parse var Arguments TreeBase SubCommand;
parse upper var SubCommand SubCommand;
if TreeBase = "" then
call SyntaxError 'Expected the name of a directory to delete.';
Directory.0 = 0;
call SysFileTree TreeBase, 'Directory', 'DS'
if Directory.0 = 0 then
call SyntaxError 'The directory "' || TreeBase || '" does not exist.';
RoutineRc = 0;
call SysFileTree TreeBase || '\*.*', 'Directory', 'DS'
do i=1 to Directory.0
DoDir = (Directory.0 - i) + 1;
parse var Directory.DoDir DirDate DirTime DirSize DirAttr DirName;
DeleteRc = Delete1Dir(strip(DirName), SubCommand);
if DeleteRc <> 0 then
RoutineRc = DeleteRc;
end;
DeleteRc = Delete1Dir(TreeBase, SubCommand);
if DeleteRc <> 0 then
RoutineRc = DeleteRc;
exit(RoutineRc);
Delete1Dir:
ThisDir = arg(1);
SpecialCommand = arg(2);
say ColorNormal || 'Deleting: ' || ThisDir;
address cmd '@attrib -r -h -s ' || ThisDir || '\*.* >nul';
call charout ,ColorError;
if stream(ThisDir || '\*.*', 'c', 'query exists') <> '' then
do
address cmd '@del "' || ThisDir || '" /n >nul';
end;
address cmd '@rd "' || ThisDir || '" >nul';
call charout ,ColorReset;
return(Rc);
SyntaxError:
CallersLine = SIGL;
call charout ,ColorError;
say "This program deletes a directory tree. It will delete files which"
say "are protected (read-only etc).";
say "";
say "CORRECT SYNTAX";
say "~~~~~~~~~~~~~~";
say " KILLTREE[.CMD] DirName";
say "";
say "REASON";
say "~~~~~";
say " " || arg(1) || ColorReset || "";
exit(CallersLine);
Die:
exit(sigl);
/* @ END FILE: E:\DB\PROJECTS\OS2\KILLTREE\KILLTREE.X (processed 109 lines) */