2013年6月16日 星期日
Procedure ListFile(List Dir.DirInfo(),rootdir.s)
Structure DirInfo
Name$
Size$
DirType.l
Path$
EndStructure
Enumeration
#Directory
EndEnumeration
Global NewList Dir.DirInfo()
Procedure ListFile(List Dir.DirInfo(),rootdir.s)
Directory$ = rootdir
If ExamineDirectory(#Directory, Directory$, "*.*")
While NextDirectoryEntry(#Directory)
If DirectoryEntryName(#Directory)<> ".." And DirectoryEntryName(#Directory)<> "."
AddElement(Dir())
Dir()\Path$=rootdir
Dir()\Name$=DirectoryEntryName(#Directory)
Dir()\Size$= Str(DirectoryEntrySize(#Directory))
If DirectoryEntryType(#Directory) = #PB_DirectoryEntry_File
Dir()\DirType = 0
Else
Dir()\DirType = 1
EndIf
EndIf
Wend
FinishDirectory(#Directory)
SortStructuredList(Dir(), #PB_Sort_Ascending, OffsetOf(DirInfo\DirType),#PB_Sort_Long)
EndIf
EndProcedure
ListFile(Dir(),"c:\windows")
dirstr.s="dir"
ForEach Dir()
dirstr=dirstr+Dir()\Name$ + ":" + Dir()\Size$+ ":" + Str(Dir()\DirType)+"|"
Next
If Len(dirstr)<8187
Debug dirstr+"->"
Else
EndIf
ClearList(Dir())
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言