Classname: wildcardlisting
Description: Is used to retrieve a list of files that match your wildcard selections from your selected folder/path.
This is an rewitten version of WildCardFilesList II as a Class.
The Class will fire Events when it finishes.
How to use this Class:
Add the file wildcardlisting.bas to your Project using Add exiting module... in the B4A ide
then initialize the object in activity_create for ex
Create Event subs based on the name you give in Initialize (in this case "wcl")
you then can use one or more of the following Sub-calls
Dependencies/Libraries: None
Tags: Files, FileList, WildCard, Recursive, File Type, ListFiles, ListFolders, ListDirs, Filtered File Types, Sorted, WildCards
V1.0 09/21/2014
============
- Initial release
Description: Is used to retrieve a list of files that match your wildcard selections from your selected folder/path.
This is an rewitten version of WildCardFilesList II as a Class.
The Class will fire Events when it finishes.
How to use this Class:
Add the file wildcardlisting.bas to your Project using Add exiting module... in the B4A ide
B4X:
Sub Globals
Dim wcl As wildcardlisting
End Sub
B4X:
wcl.Initialize(Me,"wcl")
'Initializes the object "wildcardlisting".
'vCallback = Reference to Activityobject in which the Events should be fired
'vEventname = prefix for Events to be used
Create Event subs based on the name you give in Initialize (in this case "wcl")
B4X:
Sub wcl_FilesAndFoldersFinish(DirListing As List, FileListing As List)
Log("wcl_FilesAndFoldersFinish("&DirListing.Size&","&FileListing.Size&")")
For i = 0 To DirListing.Size -1
'Log(DirListing.Get(i))
Next
For i = 0 To FileListing.Size -1
Log(FileListing.Get(i))
Next
End Sub
Sub wcl_DirListingError(error As String)
Log("wcl_DirListingError("&error&")")
End Sub
Sub wcl_ListFilesFinish(FileListing As List)
Log("wcl_ListFilesFinish("&FileListing.Size&")")
For i = 0 To FileListing.Size -1
Log(FileListing.Get(i))
Next
End Sub
Sub wcl_ListFoldersFinish(DirListing As List)
Log("wcl_ListFoldersFinish("&DirListing.Size&")")
For i = 0 To DirListing.Size -1
Log(DirListing.Get(i))
Next
End Sub
you then can use one or more of the following Sub-calls
B4X:
wcl.ClearLists
' It cleares the Dir- and Filelisting lists which will be used in Events
'
wcl.ListFilesAndFolders(File.DirRootExternal, True, "*.txt",True, True)
' It will fire the Event FilesAndFoldersFinish(DirListing As List, FileListing As List)
' when it finishes
' Lists all found folders and all mathing files
' Path = Starting path. eg. File.DirRootExternal
' Recursive = use recursive search (true/false)
' Wildcards = wildcards to use to find FILES. It is only effected on files.
' If using recursive search ALL directorys will be scanned but it
' will only find those files who matches one of the wildcards.
' eg: "*.log, *.txt"
' "*.jpg, *.png"
' Wildcards is a comma separated list with one or more entries
' Sorted = The resulting Directory-Listing or File-Listing will be sorted
' or not (true/false)
' Ascending = The resulting Directory-Listing or File-Listing will be sorted
' Ascending (true/false)
' The Event DirListingFinish will be fired when it finishes.
' The lists which will returned in this event will be cleared before this sub runs
' The Event DirListingError will be fired when the given path is not Valid
'
wcl.ListFiles(File.DirRootExternal,True, "*.wmv, *.mp4, *.mpg",True, True)
' It will fire the Event ListFilesFinish(FileListing As List)
' when it finishes
' Lists all mathing files
' Path = Starting path. eg. File.DirRootExternal
' Recursive = use recursive search (true/false)
' Wildcards = wildcards to use to find FILES. It is only effected on files.
' If using recursive search ALL directorys will be scanned but it
' will only find those files who matches one of the wildcards.
' eg: "*.log, *.txt"
' "*.jpg, *.png"
' Wildcards is a comma separated list with one or more entries
' Sorted = The resulting Directory-Listing or File-Listing will be sorted
' or not (true/false)
' Ascending = The resulting Directory-Listing or File-Listing will be sorted
' Ascending (true/false)
' The Event ListFilesFinish will be fired when it finishes.
' The list of files which will returned in this event will NOT be cleared before this sub runs
' The Event DirListingError will be fired when the given path is not Valid
'
wcl.ListFolders(File.DirRootExternal,True, True, True)
' It will fire the Event ListFoldersFinish(DirListing As List)
'when it finishes
' Lists all folders
' Path = Starting path. eg. File.DirRootExternal
' Recursive = use recursive search (true/false)
' Sorted = The resulting Directory-Listing or File-Listing will be sorted
' or not (true/false)
' Ascending = The resulting Directory-Listing or File-Listing will be sorted
' Ascending (true/false)
' The Event DirListingFinish will be fired when it finishes.
' The list which will returned in this event will be cleared before this sub runs
' The Event DirListingError will be fired when the given path is not Valid
'
Dependencies/Libraries: None
Tags: Files, FileList, WildCard, Recursive, File Type, ListFiles, ListFolders, ListDirs, Filtered File Types, Sorted, WildCards
V1.0 09/21/2014
============
- Initial release
Attachments
Last edited: