File.
ListFiles (Dir As String) As List
Returns a read only list with all the files and directories which are stored in the specified path.
An uninitialized list will be returned if the folder is not accessible.
Bug? File.ListFiles(File.DirAssets) different behaviour B4A / BaJ - klaus    
Feb 12, 2020   
(4 reactions)There is a difference between B4A and B4J with File.ListFiles(File.DirAssets).
This code works in B4A but not in B4J:
For Each FileName As String In File.ListFiles(File.DirAssets)
This code works in...
link: There is no bug here.
As the documentation in B4J says File.ListFiles doesn't support listing...
link:
So, the system behind should handle this difference and not oblige the user to take care of it, wel...
link: life.
In our case, there are two possibilities: File.DirAssets or "../files/".
So...
B4A Question [Solved] ExternalStorage.ListFiles behaving unexpectedly - agraham    
Dec 16, 2018 Long UK.jpg
ListFiles =Lat Long UK.jpg
for a known file
/storage/0000-0000/Maps OS 1000K/Lat Long... FindFile and ListFiles are looking in this folder and not the expected one. If I set filename to...
link: ListFiles "For Each f As JavaObject In files" uses the same JavaObject instance, "f"...
link: This is a workaround for the unexpected behaviour in ListFiles. Each ExternalFile in the returned...
link: We are having phone/Inernet problems so if I don't respond I'm not deliberately ignoring you...
B4A Question File.DirRootExternal and ListFiles not working - Scantech    
Aug 28, 2020TargetSDKVersion 29 and Android-29 does not work with l1.AddAll(File.ListFiles(File.DirRootExternal))
We can't populate list in File.DirRootExternal. Is there anyway to populate the list from...
link: Please do not make duplicate threads....
link: Oh, now I gotcha.
Maybe this might help:
https://www.b4x.com/android/forum/threads/externalstorage...
link: have the complete error message right now. I substitute file.dirrootexternal for file.internal and works...
B4i Question [SOLVED?] Bug in File.ListFiles in Release mode - JackKirk    
May 6, 2017 Sub
Private Sub Page1_Resize(Width As Int, Height As Int)
Private wrk_files As List
Private wrk_str As String
Private wrk_ptr As Int
'Get names of files in assets directory
wrk_files = File.ListFiles(File.DirAssets)
'For all files...
For wrk_ptr = 0 To...
link: You shouldn't use File.ListFiles with the assets folder. I will add a note about it in...
link: ).
You shouldn't use File.ListFiles with the assets folder. I will add a note about it in...
B4A Question File.ListFiles behaving unexpectedly - teddybear (first post)    
Mar 14, 2022The code you post is correct, if the folder is not existed, error xxx is not a folder. the RuntimeEx...
link:
If File.Exists(File.DirInternal, "/Pldata") = False Then
File.MakeDir(File...
link: What is the output of the code I posted?...
link: As List=File.ListFiles(File.DirInternal & "/Pldata")
lstFile.Sort(True)
error still...
B4A Question Strange behaviour from File.listFile - LucaMs (first post)    
Dec 29, 2021, "Third file")
LogFiles
For Each FileName As String In File.ListFiles(File.DirInternal... LogFiles
Log("Files in DirInternal: " & File.ListFiles(File.DirInternal).Size)
For...
link: LucasMs, the apps crashed without any message.
Erel, ysterday, it doesn't work, I restarted the...
link:
File.ListFiles returns an array.
123555
So
lifi = ListFiles(...)
will work (although it would...
link:
Have I forgotten something ?
Yes, carefully read my answer. I'm using AddAll, not Add....
B4A Question File.ListFiles(File.Assets) in Debug - lip (first post)    
Sep 29, 2021   
(1 reaction) the list of files you need to use in that text document. Then your app can open the (known) text document, and use its contents as your file list (prepending the necessary file path) to work with. If...
link:
How did the files get into that directory? Where did they come from? And how did you know...
link: I am
This works, unless I am lost also:
For Each f As String In File.ListFiles(File.DirAssets...
link: .
'Get files from Tablet
Dim AssetFiles As List
AssetFiles = File.ListFiles(File.DirAssets...
B4A Question File.ListFiles not listing all the files - Jookus (first post)    
Apr 12, 2021I didn't realize I had outdated SDK. I updated it and wow the above mentioned line in manifest works and all files are shown.
Thank you very much! I really appreciate your help....
link: produce an error, but possibly it is only showing you media files for some reason.
Targeting SDK 29...
link: the app again but with same results: some of the files in the folder are being listed, but not all...
link: What is your target SDK set to? If 29 have you got this in the manifest?
SetApplicationAttribute(an...
B4A Question [SOLVED] Problem using File.ListFiles on Download folder - did something change? - Erel (first post)    
Feb 7, 2021This is a short term solution. It will stop working at some point....
link:
Thanks @agraham. I found this just as you answered!
In summary, for now, add this to manifest edit...
link: "&A)
fileList = File.ListFiles(A)
For i = 0 To fileList.Size-1...
link:
You can't do that in API 29. Read this for the workaround or target API 28 when it will still ...
B4A Question Problem with File.ListFiles on an external sdcard with Android 4.4.2 - klaus    
Mar 31, 2014   
(1 reaction) reading files on the external sd card.
The code below works on previous versions of Android.
Sub Activity_Create(FirstTime As Boolean)
lblFiles.Initialize("")
Activity.AddView(lblFiles, 10%x, 10%y, 80%x, 80%y)
Dim lst0 As List
lst0 = File.ListFiles("/sdcard1/"...
link: Thanky you, that fixed it....
link: there is any reference to File.DirRootExternal or File.DirDefaultExternal.
You can also add...
Page: 1  
2  
3  
4  
5  
6  
7