AppleScript list with grep and subfolder

Sometimes its useful to have a script that return a list. There we could choose a item.
We could set the target directory, search string and when the directory is updated it still work.

Here is my approach.

This example use home directory of the user, but it could be any directory.
We use grep to filter the result. The less subfolder we need to scan with ls the faster it is.

set theMessage to "Type the search string:"
set theString to (display dialog theMessage default answer "")'s text returned
set theFolder to POSIX path of (path to home folder)
set myList to do shell script "cd " & theFolder & "; " & "ls -1R " & "| grep -i " & theString
set theList to every paragraph of myList
choose from list theList

Here is other one.

set theMessage to "Type the search string:"
set theString to (display dialog theMessage default answer "")'s text returned
set theFolder to POSIX path of (path to home folder)
set myList to do shell script "ls -d " & theFolder & "* | grep -i " & theString
set theList to every paragraph of myList
choose from list theList

This is properly more useful, to get files 1 level of subfolder

set theMessage to "Type the search string:"
set theString to (display dialog theMessage default answer "")'s text returned
set theFolder to POSIX path of (path to home folder)
set myList to do shell script "ls -d " & theFolder & "*/* | grep -i " & theString
set theList to every paragraph of myList
choose from list theList