Gettree('c:\') Function gettree Lparameters tcDirectory Start = seconds() oFS = CREATEOBJECT('Scripting.FileSystemObject') oFolder = oFS.GetFolder(tcDirectory) Dimension aFolders[1,1] aFolders[1]=tcDirectory tcDirectory = iif(oFolder.IsRootFolder(), substr(tcDirectory,1,len(tcDirectory)-1), tcDirectory) =_SubFolders(oFolder, tcDirectory, tcDirectory) Asort(aFolders) ? seconds()-start Create cursor crsFolders (Folder m) Append from array aFolders Go top Browse Function _SubFolders Lparameters toFolder, tcPath, tcStartPath Local loSubFolders tcPath = tcStartPath For each oSubFolder in toFolder.Subfolders If oSubFolder.Name # "System Volume Information" Dimension aFolders[alen(aFolders,1)+1,1] aFolders[alen(aFolders,1),1] = tcPath+"\"+oSubFolder.name =_SubFolders(oSubFolder, tcPath, tcPath+"\"+ oSubFolder.name) Endif EndforoFS also has many other capabilities like :
oFolder = oFS.Getfolder('c:\Some folder') for each oFile in oFolder.Files with oFile ? .Name, ; .DateCreated, ; .DateLastAccessed, ; .DateLastModified, ; .Size, .Type, ; .ShortName, .ShortPath .Attributes = bitor(.Attributes,0x01) && Set read only endwith endfor oFS.CopyFolder(SourceDir, TargetDir)Unlike ADIR() it can access to any folders.