home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
MOUSEDIR.ZIP
/
KILLDIR.KEX
next >
Wrap
Text File
|
1992-03-16
|
2KB
|
45 lines
/* */
/* Load necessasry functions from REXXUTIL package */
If RXFUNCQUERY('SysFileTree') = 1 Then,
Call RXFUNCADD 'SysFileTree','RexxUtil','SysFileTree'
If RXFUNCQUERY('SysFileDelete') = 1 Then,
Call RXFUNCADD 'SysFileDelete','RexxUtil','SysFileDelete'
If RXFUNCQUERY('SysRmDir') = 1 Then,
Call RXFUNCADD 'SysRmDir','RexxUtil','SysRmDir'
Arg subdir
'DIALOG /Deleting directory' subdir' and all its files!!!/okcancel defbutton 2'
If dialog.2 <> 'OK' Then Exit 16
drc = SYSFILETREE(subdir'\*.*','dirs','ds') /* get subdir list */
If drc <> 0 Then Do
'MSG Cannot delete' subdir'. (RC='drc')'
Exit 28
End
frc = SYSFILETREE(subdir'\*.*','files','fs') /* get file list */
'set reserved 11 yellow On red'
/* delete all the files from the subdirs */
Do i = 1 To files.0
file = WORD(files.i,WORDS(files.i))
rc = SYSFILEDELETE(file)
If rc <> 0 Then Do
'set reserved 11' file 'not deleted. rc from SYSRMDIR:' rc
Exit 28
End
'set reserved 11 DELETED: ' file
'refresh'
End
/* must delete subdirs in reverse order */
Do i = dirs.0 To 1 By -1
dir = WORD(dirs.i,WORDS(dirs.i))
rc = SYSRMDIR(dir)
If rc <> 0 Then Do
'set reserved 11' dir 'not deleted. rc from SYSRMDIR:' rc
Exit 28
End
'set reserved 11 deleted' dir
'refresh'
End
rc = SYSRMDIR(subdir)
'set reserved 11 Off'
'msg DELETED: ' subdir