lparameters startdir, cfilename start=seconds() set talk off local lcCursorName, llRHSExists lcCursorName = "C_"+sys(2015) dimension aTree[1,2] aTree[1,1] = startdir aTree[1,2] = "" =gettree(startDir, @aTree) ? seconds()-start create cursor filelist ; (directory m,filename c(40), ; filesize i,filedate d,filetime c(8),fileattr c(5)) set defa to (startdir) for ix = 1 to alen(aTree,1) =checkfile(aTree[ix,1],cFileName) endfor ? seconds()-start select filelist browse return function gettree lparameters tcPath, taTree && Start path, array to insert local lcTopDir,ix lcTopDir = sys(5)+curdir() set defa to (tcPath) lcCurdir = sys(5)+curdir() =getsubdirs(lcCurdir, @taTree) set default to (lcTopDir) =asort(taTree,1,-1,1) && Sort descending - in case this is a removedir operation for ix =1 to alen(taTree,1) if !empty(chrtran(taTree[ix,2],"AD.","")) return .t. && Hidden or system dir exists endif endfor return .f. function getsubdirs lparameters tcPath, taTree 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] dimension taTree[alen(taTree,1)+1,2] taTree[alen(taTree,1),1] = tcPath+laDirs[ix,1] taTree[alen(taTree,1),2] = laDirs[ix,5] =getsubdirs(tcPath+laDirs[ix,1]+"\", @taTree) endif endfor *************************************************************************** * CHECKFILE : CHECK cFileName in cDirectory and insert into cursor filelist *************************************************************************** function checkfile lparameters cDirectory,cFileName private aDirectory, ix nFileCnt = adir(aDirectory,cDirectory+iif(right(cDirectory,1)#"\","\","")+cFilename) if nFilecnt > 0 for ix=1 to alen(aDirectory,1) insert into filelist values ; (cDirectory,aDirectory[ix,1],; aDirectory[ix,2],aDirectory[ix,3],; aDirectory[ix,4],aDirectory[ix,5]) endfor endifCetin