As this is a Blitz3D forum one would assume he wanted some blitz3d code example, but none the less.
Rez, this function will scan a folder and report the total files and directories found, its recursive so it scans children directories within the given directory. If you don't want it to scan the children directoires just comment out the ScanDir() within the function itself.
Global DirCount, FileCount
ScanDir("C:\temp" )
RuntimeError "Total Dirs: "+DirCount+" || Total Files: "+FileCount
Function ScanDir(folder$)
myDir=ReadDir(folder$)
Repeat
file$=NextFile$(myDir)
If file$="" Then Exit
If FileType(folder$+"\"+file$) = 2 Then
If file$<>"." And file$<>".." Then
ScanDir(folder$+"\"+file$)
DirCount=DirCount+1
EndIf
Else
FileCount=FileCount+1
End If
Forever
CloseDir myDir
End Function
|