I have yet to show such an example, but mine has the same meaning. This is the first time I come across this, an experienced one will immediately understand. NOT an option to use temporary file.
Tnx
Code: Select all
; DLL FILE
CompilerSelect #PB_Compiler_OS
CompilerCase #PB_OS_Windows
#sep$ = "\"
CompilerCase #PB_OS_Linux
#sep$ = "/"
CompilerEndSelect
Procedure __FileSearch2(sPath.s, List Files.s(), RID)
Protected sName.s, c = 0
Protected Dim aExaDir(125)
Protected Dim aSePath.s(125)
aSePath(c) = sPath
aExaDir(c) = ExamineDirectory(#PB_Any, sPath, "*")
If Not aExaDir(c)
ProcedureReturn 0
EndIf
Repeat
While NextDirectoryEntry(aExaDir(c))
sName=DirectoryEntryName(aExaDir(c))
If sName = "." Or sName = ".."
Continue
EndIf
If DirectoryEntryType(aExaDir(c)) = #PB_DirectoryEntry_Directory
sPath = aSePath(c)
c + 1
aSePath(c) = sPath + sName + #sep$
aExaDir(c) = ExamineDirectory(#PB_Any, aSePath(c), "*")
If Not aExaDir(c)
c - 1
EndIf
Else
If MatchRegularExpression(RID, sName) And AddElement(Files())
Files() = aSePath(c) + sName
EndIf
EndIf
Wend
FinishDirectory(aExaDir(c))
c - 1
Until c < 0
EndProcedure
ProcedureDLL.s _FileSearch(*Result.string, Path$, Mask$ = ".+?")
Protected RID, Len, Res, *Point
NewList Files.s()
RID = CreateRegularExpression(#PB_Any, Mask$)
If RID
If Right(Path$, 1) <> #sep$
Path$ + #sep$
EndIf
If __FileSearch2(Path$, Files.s(), RID)
FreeRegularExpression(RID)
EndIf
Else
ProcedureReturn
Debug RegularExpressionError()
EndIf
Len=0
ForEach Files()
Len + Len(Files())+2
Next
*Result\s = Space(Len)
*Point = @*Result\s
ForEach Files()
CopyMemoryString(Files()+#CRLF$, @*Point)
Next
ClearList(Files())
EndProcedure
Code: Select all
Define StartTime=ElapsedMilliseconds()
Define Path$ = "C:\Users\37258\Desktop\Codes" ; <<<- DIRECTORY
Define Result.string
_FileSearch(@Result, Path$, "\A.*?\.pb\z")
Debug Result\s