Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: Search Find Files Finder Specified Array Size VMalloc Recursive Array String Size Memory Limit
;*************************************************************************** ;** File Finder using Specified Array Size ;** ( for use with a large number of files ) ;** ;** Purpose: Search and Store a Large Number of Filenames to a File. Avoids ;** Running into String Size Limits ( vMalloc errors ) ;** Inputs: ;** Outputs: Results in a output file ;** Reference: ;** REQUIRES WinBatch 2013A or newer ;** ;** Developer: Deana Falk 2014.05.09 ;*************************************************************************** AddExtender ("wwfaf44i.dll",44005) ; File and Folder Finder. Use 44005 to avoid duplicates from reparse points If Version( )< '2013C' Pause('Notice', 'Need 2013A or Newer Version of WinBatch') ; ArrayItemize Exit EndIf ; Search for files strFolderSource = 'C:\' strFileMask = '*' strMsgTitle = 'Search for files.' strMsgText = "" BoxOpen (strMsgTitle, strMsgText) WinPlace (050, 100, 950, 600, "") BoxDataTag (1, 1) strFolderTemp = ShortCutDir ("Local Settings") : "\Temp\" strFileOut = StrInsert (StrReplace (TimeYmdHms (), ":", ""), ".", "", 9) : ".List.txt" strFileOut = strFolderTemp : strFileOut hdlFile = FileOpen(strFileOut,'Append') ;fafHidden = 1 ; Include hidden files. ;fafSystem = 2 ; Include system files. ;fafFolders = 4 ; Inspect subfolder names also. ;fafFindFolders = 8 ; Only inspect subfolder names not file names. fafRecurse = 16 ; Recurse through subfolders. ;fafNoPathInfo = 32 ; Do not return path information to files or folders found. ;fafNoRedirect = 64 ; Do not turn off file redirection for x64 windows. chunksize = 1024*10 arrList = ArrDimension (chunksize) arrPtr = 0 hdlFAF = fafOpen (strFolderSource, strFileMask, fafRecurse) While @TRUE strFileFullName = fafFind (hdlFAF) If strFileFullName == "" Then Break ; Limits the size of the array that holds the list of file names If arrPtr >= chunksize ; Convert array to @lf delimted list strList = ArrayItemize( arrList, @LF ) strList = StrReplace( strList, @LF, @CRLF ) ; Append files to output file FileWrite(hdlFile, strList) ; Re-initialize the array ArrInitialize(arrList, '') arrPtr = 0 Drop(strList) EndIf arrList[arrPtr] = strFileFullName arrPtr = arrPtr+1 BoxText (strFileFullName) BoxDataClear (1, 1) EndWhile ; Convert remaining array to @lf delimted list strList = ArrayItemize( arrList, @LF ) strList = StrReplace( strList, @LF, @CRLF ) ; Append files to output file FileWrite(hdlFile, strList) fafClose (hdlFAF) FileClose(hdlFile) If FileExist (strFileOut) == 1 Then Run (strFileOut, "") Exit
Article ID: W17573
Filename: File Finder using Specified Array Size.txt
File Created: 2014:05:09:08:55:00
Last Updated: 2014:05:09:08:55:00