|
|
|
| 4 June 2002 | DelDirTree() |
| Author | Gwydion |
| Action | Deletes all directories and files under $root ($root is excluded). Excludes from deletion any directory (and its content) listed in $excludelist. $excludelist is a string containing a semicolon-separated list of dirs. |
| Syntax | DelDirTree ($root, [$excludelist]) |
| Parameters | |
| Remarks | Recursive |
| Returns | Nothing |
| Dependencies | None. |
| Examples |
DelDirTree ("C:\Temp", "SETTINGS;LET")
; it deletes anything under "C:\Temp",
; but not
; "C:\Temp" itself,
; "C:\Temp\SETTINGS" (with all the files in it) and
; "C:\Temp\LET" (with all its files).
|
| Source |
FUNCTION DelDirTree ($root, OPTIONAL $excludelist)
DIM $fullpath
$excludelist = Ucase ($excludelist + ";")
DEL $root + "\*.*" ;delete all files in root
$dirname = Dir($root + "\*.")
WHILE (($dirname <> "") AND (@error = 0))
$dirname = Ucase ($dirname)
IF (($dirname <> ".") AND ($dirname <> "..")) ;ignore "root entries"
IF ((InStr ($excludelist, $dirname+";") = 0) AND (InStr ($excludelist, $root+'\'+$dirname+";") = 0))
$fullpath = $root+"\"+$dirname
deldirtree ($fullpath)
RD $fullpath
ENDIF
ENDIF
$dirname = Dir() ;retrieve next dir
LOOP
ENDFUNCTION ; - DelDirTree -
|
|
|
|