home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Pier Shareware 6
/
The_Pier_Shareware_Number_6_(The_Pier_Exchange)_(1995).iso
/
035
/
perf31.zip
/
perf_30
/
elimdir.cmd
< prev
next >
Wrap
OS/2 REXX Batch file
|
1994-11-06
|
3KB
|
103 lines
/* ELIMDIR - Eliminates Directories, Sub-Directories and all the files in those directories*/
/*Copyright (c) 1994 CLEAR & SIMPLE, INC.*/
ECHO OFF
Signal on Error
rc=RXQUEUE("Create", 'elimdirQ')
rc=RXQUEUE("Set", 'elimdirQ')
do queued()
pull
end
call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
call SysLoadFuncs
red ='
A'
green ='
A'
yellow ='
A'
blue ='
A'
white ='
A'
black ='
A'
arg deaddir Confirm .
if deaddir='' then do
echo on
'prompt $p$E[0;'34';'47';'5';'5'm]'
echo off
'cls'
say blue;say 'ELIMDIR - Eliminates Directories (and Files and Sub-Directories)'
say black;say ' Performance PLUS V3 PLUS CopyRight (c) 1994, Clear & Simple, Inc.'
say blue;say;say 'ElimDIR was written to be executed from the command line.'
say;say ' e.g. ElimDir D:\OLDDATA '
say;say 'You have either started it from the ICON or without parameters.'
say; say red; say 'U S E ElimDir W I T H G R E A T C A U T I O N'
SAY;SAY GREEN;say 'It will easily delete entire directories INCLUDING ALL FILES!'
SAY;SAY RED;say 'C A U T I O N ! ! ! - READ THE PLUSread.me BEFORE USING'
SAY; SAY BLUE; say 'Press any key to end'; key=sysgetkey()
EXIT
end
deaddir=strip(deaddir,'T','\')
say 'Deleting Directory:' Deaddir
say ' and all files and subdirectories within that directory!'
if translate(Confirm) \= 'Y' then do
say red; say; say ' ***** C A U T I O N *****'
say ' This program will delete ALL FILES and ALL Directories! '
say ' Are you sure you want to proceed?'; say;
say blue; say 'Press "Y" and Enter to continue';SAY WHITE; pull okay
if okay \= 'Y' then do
SAY WHITE; say 'NO DELETION!'; exit
end /* Y Do */
end /* Confirm Do */
IF filespec('drive',deaddir)='' then if right(directory(),1)='\'then deaddir=directory()||deaddir
else deaddir=directory()'\'deaddir
parse var deaddir drive ':' rest
if left(rest,1) ='\' | rest='' then do;
parse var rest '\' rest1;
if rest1='' then do;
say 'Is the ROOT DIRECTORY of DRIVE 'drive '?';
say 'ARE YOU SURE YOU WANT TO DELETE THE ENTIRE DRIVE?'
say "To continue you must respond 'YES'";
pull ans; if ans \= 'YES' then do
say white; say 'NO DELETION!'; exit
end /* YES Do */
end /* rest1 do*/
end
rc=SysFileTree(deaddir'\*.*',dirs,'BS', '*****', '-----')
do i=1 to dirs.0
parse var dirs.i day time size att file
push att file;
end
do Queued()
pull att file;file=strip(file,'L');filewithblanks='"'file'"';
if pos('D', att) = 2 then 'RD' filewithblanks
else do; 'del' filewithblanks '/N'; end
end
if ans\='YES' then do
'RD' DEADDIR
end
RC=RXQUEUE('Delete', 'elimdirQ')
Say; say ' Deletion of ' deaddir 'Completed!'
exit
error:
say 'Errors have occured'
say 'Probably a file in the directory structure' deadir
say ' is being used by another process or the directory'
say ' is active in another active command prompt window.'
say 'deaddir is =' deaddir
do queued()
pull
end /* do */
rc=RXQUEUE('Delete', 'elimdirQ')
exit