function DelTree >lParameters cPath >cPath = upper(alltrim(cPath)) >cPath = cPath+iif(right(cPath,1) # "\","\","") >if substr(cPath,1,1) = "\" > cPath = sys(5)+cPath >endif >if cPath == "\" or substr(cPath,2) == ":\" && Oooops. Root directory > messagebox(cPath + " is a root directory !") > return .f. >endif >if !directory(cPath) > messagebox(cPath + " is not a directory !") > return .f. >endif >if sys(5)+curdir() == cPath > messagebox(cPath + " is current directory") > return .f. >endif >if sys(5)+curdir() = cPath > messagebox("Current directory is a subdirectory of "+cPath) > return .f. >endif > >return iif(messagebox("Are you sure to remove ["+cPath + "] ?",4+32+256) = 7,; > .f.,removedir(cPath)) > >function removeDir >lparameters cDirPath >local lcCursorName, llRHSExists >lcCursorName = "C_"+sys(2015) >llRHSExists=gettree(cDirPath,lcCursorName) >if llRHSExists > messagebox("Read Only, Hidden or System dir encountered...") > use > return .f. >endif >index on trim(dirname) tag dirname descending >scan > erase (trim(dirs.dirname)+"\*.*") && Erase files > rmdir (trim(dirs.dirname)) >endscan >use > >function gettree >lparameters tcPath, tcCursorName >local lcTopDir >lcTopDir = sys(5)+curdir() >set defa to (tcPath) >create cursor (tcCursorName) ; > (dirname c(127),attr c(5)) >lcCurdir = sys(5)+curdir() >insert into (tcCursorName) ; > (dirname) values (tcPath) >=getsubdirs(lcCurdir, tcCursorName) >set default to (lcTopDir) >locate for !empty(chrtran(attr,"AD.","")) >return !eof() > >function getsubdirs >lparameters tcPath, tcCursorName >local lcCurDir, lnSubDirs, ix >local array laDirs[1] >lnSubdirs=adir(laDirs,tcPath+"*.*","HD") >for ix = 1 to lnSubDirs > if laDirs[ix,1]#"." and "D"$laDirs[ix,5] > insert into (tcCursorName) ; > values (tcPath+laDirs[ix,1],laDirs[ix,5]) > =getsubdirs(tcPath+laDirs[ix,1]+"\", tcCursorName) > endif >endforCetin