scripting@wanadoo.nl




DelDirTree()

http://www.scriptlogic.com/kixtart/FunctionLibrary_FunctionList.aspx


actual FunctionLibrary list on 'Scriptlogic' site printer-friendly mirror of UDF topic on 'scripting@wanadoo.nl' site close
4 June 2002 DelDirTree()
AuthorGwydion
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.
SyntaxDelDirTree ($root, [$excludelist]) 
Parameters
  • $root (Required / String) Is the directory containing the stuff to be deleted
  • $excludelist (Optional / String) Semicolon-separated list of subdirectories to be excluded from deletion 
  • RemarksRecursive 
    ReturnsNothing 
    DependenciesNone. 
    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 -
     
      original source of UDF topic. show actual FunctionLibrary list on Scriptlogic site close top
              printer-friendly mirror of UDF topic on scripting@wanadoo.nl site  




    Copyright © 2003 www.scriptlogic.com & scripting@wanadoo.nl - last updated on 20 May 2003


    Site Meter