the call is passed as a function parameter for each directory file
Code: Select all
EnableExplicit
#RecursivelyYes = 1
#RecursivelyNo = 0
Procedure FR(Directory_File_FullName.s) ;File revision
Debug Directory_File_FullName
EndProcedure
Procedure Walk_Dir(SearchPath.s,*ppp,Recursively)
Protected Directory_ID.i
Protected Directory_Entry_ID.i
Protected Directory_Entry_Type.i
Protected Directory_Entry_Name.s
Protected Directory_File_FullName.s
Protected SPath.s
Protected RightChar.s
RightChar = Right(SearchPath,1)
SPath = SearchPath
CompilerIf #PB_Compiler_OS = #PB_OS_Windows
If (RightChar <> "\")
SPath = SPath + "\"
EndIf
CompilerElse
If (RightChar <> "/")
SPath = SPath + "/"
EndIf
CompilerEndIf
Directory_ID = ExamineDirectory(#PB_Any, SPath, "*.*")
If (Directory_ID)
Directory_Entry_ID = NextDirectoryEntry(Directory_ID)
While (Directory_Entry_ID)
Directory_Entry_Type = DirectoryEntryType(Directory_ID)
Directory_Entry_Name = DirectoryEntryName(Directory_ID)
If (Directory_Entry_Type = #PB_DirectoryEntry_File)
Directory_File_FullName = SPath + Directory_Entry_Name
CallFunctionFast(*ppp,@Directory_File_FullName)
Else
If Recursively
If ((Directory_Entry_Name <> ".") And (Directory_Entry_Name <> ".."))
Walk_Dir(SPath + Directory_Entry_Name,*ppp,Recursively)
EndIf
EndIf
EndIf
Directory_Entry_ID = NextDirectoryEntry(Directory_ID)
Wend
EndIf
EndProcedure
Walk_Dir(GetTemporaryDirectory(),@FR(),#RecursivelyNo) ;#RecursivelyYes