Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/Util/FileList/FileList Recursive
Function:
Required plugins for this example: MBS Util Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Util/FileList/FileList Recursive
This example is the version from Wed, 16th Feb 2016.
Project "FileList Recursive.rbp"
Class Window1 Inherits Window
Control List Inherits ListBox
ControlInstance List Inherits ListBox
End Control
Control pbMBS Inherits PushButton
ControlInstance pbMBS Inherits PushButton
EventHandler Sub Action() dim TheFolder as folderItem dim t as integer list.deleteAllRows TheFolder=SelectFolder t=ticks LoadFolderMBS(TheFolder) t=Ticks-t self.title=cstr(list.listcount) + " files in "+str(t)+" ticks." End EventHandler
End Control
Control pbRB Inherits PushButton
ControlInstance pbRB Inherits PushButton
EventHandler Sub Action() dim TheFolder as folderItem dim t as integer list.deleteAllRows TheFolder=SelectFolder t=Ticks LoadFolderRB(TheFolder) t=ticks-t self.title=cstr(list.listcount) + " files in "+str(t)+" ticks." End EventHandler
End Control
Protected Sub LoadFolderMBS(f as folderItem) dim s,p as string dim g as new FileListMBS(f) dim c as integer = g.Count-1 for i as integer = 0 to c if g.Directory(i) then s=g.Name(i) List.AddRow s List.Cell(List.LastIndex,1)="-" p=f.absolutePath List.Cell(List.LastIndex,2)=p+s LoadFolderMBS g.item(i) elseif g.Visible(i) then s=g.Name(i) List.AddRow s List.Cell(List.LastIndex,1)=format(g.LogicalDataLength(i)/1024,"0")+" KB" p=f.absolutePath List.Cell(List.LastIndex,2)=p+s end if next End Sub
Protected Sub LoadFolderRB(f as folderItem) dim i as integer dim t as integer dim g as FolderItem dim c as integer c=f.Count for i=1 to c g=f.trueitem(i) if g.directory then List.AddRow g.Name List.Cell(List.LastIndex,1)="-" List.Cell(List.LastIndex,2)=g.absolutePath LoadFolderRB(g) elseif g.Visible and left(g.name,1)<>"." then List.AddRow g.Name List.Cell(List.LastIndex,1)=format(g.length/1024,"0")+" KB" List.Cell(List.LastIndex,2)=g.absolutePath end if next End Sub
End Class
MenuBar Menu
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = "File"
MenuItem FileQuit = "Quit"
MenuItem UntitledMenu0 = "Edit"
MenuItem EditUndo = "Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cut"
MenuItem EditCopy = "Copy"
MenuItem EditPaste = "Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class App Inherits Application
End Class
End Project

See also:

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS Util Plugin.





Links
MBS Xojo Plugins