home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
kt_98125.zip
/
KILLTREE.CMD
Wrap
OS/2 REXX Batch file
|
1998-05-05
|
2KB
|
73 lines
/*
* 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 = '
';
ColorHighlight = '
';
ColorNormal = '
';
ColorReset = '';
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) */