Oct 29 2011
01:10 Hours
I have been looking for code to be able to recurse all of the folders and files on SdCard. I found some VB6 code and converted it to B4A.
Here is the essential code of this project:
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
Download the project and try it.
Please leave comments.
Thanks
			
			01:10 Hours
I have been looking for code to be able to recurse all of the folders and files on SdCard. I found some VB6 code and converted it to B4A.
Here is the essential code of this project:
			
				B4X:
			
		
		
		Sub SdCard(CurPath As String)
Dim FileList, FolderList As List
Dim F As String
FileList.Initialize 
FolderList.Initialize 
If CurPath = "" Then
   CurPath = "/mnt/sdcard"
End If
If File.IsDirectory(CurPath,"") Then
   Try
   FileList = File.ListFiles(CurPath)
   If FileList.IsInitialized Then
      If FileList.Size > 0 Then
         F = CurPath
         Listview1.AddSingleLine(F)
         CodeModule.ViewList.Add(F) 
         For i = 0 To FileList.Size - 1 
            F = FileList.Get(i)
            If File.IsDirectory(CurPath & "/" & F,"")Then
               FolderList.Add(CurPath & "/" & F) 
            Else
               Listview1.AddSingleLine(CurPath & "/" & F)
               CodeModule.ViewList.Add(CurPath & "/" & F) 
               Counter = Counter + 1
               LabelCounter.Text = Counter
            End If
            DoEvents
         Next
      End If
   End If
   Catch
      Msgbox(LastException & " " & CurPath & " " & FileList.Size,"File")
   End Try
   'Recursive Code
   Try
   If FolderList.IsInitialized Then
      If FolderList.Size > 0 Then
         For i = 0 To FolderList.Size - 1 
            F = FolderList.Get(i)
            SdCard(F)         
            DoEvents
         Next
      End If      
   End If
   Catch
      Msgbox(LastException & " " & FolderList.Size & " " & F,"Folder")
   End Try
End If
End SubDownload the project and try it.
Please leave comments.
Thanks
 
				 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		