' 2019-09-27 ' Create an empty database ' Insert a table that contains the path name, file name and file size ' for all the files under a given folder and its sub-folders. ' Uses the File System Object to get the information newscript dim startAt, stopat, cntFiles ' close any open database dbclose ' now open an empty database , in memory dbopen ("memory") ' create an empty table to hold the file information create table myFiles ( Path text, File text, Size Int ) cntFiles = 0 Sub ShowSubFolders(Folder) dim Subfolder, objFolder, colFiles , objFile dim tmpStr = "insert into myFiles values ( " & sqlstring (Folder.Path) & "," colFiles = Folder.Files For Each objFile in colFiles sql = tmpStr & sqlstring (objFile.Name) & "," & objFile.Size & ")" cntFiles = cntFiles + 1 Next objFile For Each Subfolder in Folder.SubFolders call ShowSubFolders ( Subfolder) Next Subfolder ' technically the END Sub command will release any objects created within the sub routine. End Sub ' create a File System Object dim objFSO = CreateObject("Scripting.FileSystemObject") startat = tick ' will use the Folder in which this executable is located as the starting point call ShowSubfolders ( objFSO.GetFolder(ExecutionPath) ) stopAt = tick message = "It took " & cint ( abs ( startat - stopat) / tickrate ) & " seconds to handle " & cntFiles & " files." & chr(0x0a) & " = " _ & cint ( abs ( startat - stopat) * 1000 / tickrate / cntFiles ) & " milli seconds per file on average" ' technically the next call to the NEWSCRIPT command will release any objects.