Searching text files

49 views
Skip to first unread message

Kelechi Ekezie

unread,
Nov 2, 2021, 4:58:51 AM11/2/21
to DroidScript
Hi everyone how can I get all the txt files on my device
I tried app.ListFolder('/sdcard', '.txt') but it only returns text files in the home directory and doesn't return text files in subfolder

Alan Hendry

unread,
Nov 2, 2021, 7:51:06 AM11/2/21
to DroidScript
Hi,

You could hard-code a list of folders to search. 

Or start at /sdcard listing all the txt files, and all the subfolders, then process the sub-folders,
and the sub-sub-folders, etc.

shows how to retrieve data from Android directly, not sure if it can do what you want.

Regards, ah

Kelechi Ekezie

unread,
Nov 4, 2021, 9:01:03 AM11/4/21
to DroidScript
Hi i didnt find a way to use the query content
So i tried the second option but i was only able to get txt files in home directory and folders in home directory
I wasnt able to get txt files in sub-folders

Kelechi Ekezie

unread,
Nov 4, 2021, 9:28:29 AM11/4/21
to DroidScript
Hi i didnt find a way to use the query content
So i tried the second option but i was only able to get txt files in home directory and folders in home directory
I wasnt able to get txt files in sub-folders and subsubfolders 

Pls have u done a similar project like this before?
If so, can u upload the part containing the listing of files and folders and subfolders and sub-subfolders before

On Tuesday, 2 November 2021 at 12:51:06 UTC+1 hendr...@gmail.com wrote:

Alan Hendry

unread,
Nov 4, 2021, 12:47:45 PM11/4/21
to DroidScript
HI,

I meant to get a list of text files in home directory, then a list of the folders under  the home directory,
then for each folder - get a list of the text files in the folder (add to your list of text files so far)
then for each folder - get a list of subfolders, etc.

In Android 10+ there will be folders that you can't read, but you CAN read the subfolders
(for example in an SPK you won't be able to read Android > data but you can read com.smartphoneremote.androidscriptfree).
So the alternative is to hard code a list of folders you want to access.

Regards, ah
Reply all
Reply to author
Forward
0 new messages