the UNIX ls command

can’t get the UNX ls command to work, I know I don’t have the syntax right.
Here is my code, can anyone straighten me out. Thanks.

set the_SCRIPTS to (do shell script "ls baseFolder01 & " / " & /‘’ " & theFile2 & '’)

Assuming that baseFolder01 and theFile2 are AppleScript variablesyou’ll need something like this:

set the_SCRIPTS to paragraphs of (do shell script "ls  " & baseFolder01 & "/'*' " & theFile2 & "'*'")

thanks but I didn’t get any results, can you help me search for a file, here is the folder structure. I know Applescript pretty well but its slooooow. I don’t know UNIX.

lets say I’m look for a file in Folder5, subfolder 3 and the file contains the word sunny.

AudioNAS
AH2
folder1 (many sub folders)
folder2 (many sub folders)
folder3 (many sub folders)
folder4 (many sub folders)
folder5 (many sub folders)

It was my understanding that single quoting the * in the shell enforces its literal value. I tried the following and it returns a list of matching files as expected:

set baseFolder01 to quoted form of "/Users/bob/Test Documents"
set theFile2 to "Text"
set the_SCRIPTS to paragraphs of (do shell script "ls " & baseFolder01 & "/*" & theFile2 & "*")

here is what I came up with:

set baseFolder01 to “Macintosh HD:Users:shawn:Desktop:Test_123:”
set xxx to POSIX path of baseFolder01
set myVar to do shell script "ls " & xxx

the result is instant and lists all files in the folder

Your code in post #5 sort of works, but it will fail with any folder that has a space in the name, as it’s not properly quoted. I would also advise against variabilizing items used only once.

do shell script "ls " & (path to desktop)'s POSIX path & "Test 123"'s quoted form--note the folder name change and adjust accordingly for testing

The syntax you originally attempted—prior to refining your question—appears to be for the more fully featured find command.

do shell script "find -E " & my (choose folder)'s POSIX path's quoted form & " -maxdepth 4 -type f -regex " & (".*" & ("Sunny") & ".*")'s quoted form