create list from shell script find results

I am cobbling together a find and replace script to rename image files across various folder and volumes. I know nothing about shell scripts but I found this one which produces the result as a series of posix paths.

Is there a way I can convert this result to a list? I can convert the posix path to a HFS path but I can’t find a way to get the list to begin with.

This:
set theseFiles to do shell script " /usr/bin/find ~ -name ‘Alice Baker.jpg’ -print -exec /usr/bin/ {} \;"
will result in this:
{“/Users/johnclark/Desktop/test4/Alice Baker.jpg
/Users/johnclark/Documents/WORK/GROUP PROCESS/GROUP TO BE PROCESSED/Stagecoach Image Pool/BW Database/ Thumbnails_large/Alice Baker.jpg
/Users/johnclark/Documents/WORK/GROUP PROCESS/GROUP TO BE PROCESSED/Stagecoach Image Pool/BW Database/ Thumbnails_small/Alice Baker.jpg
/Users/johnclark/Documents/WORK/GROUP PROCESS/GROUP TO BE PROCESSED/Stagecoach Image Pool/BW Hi Res/Alice Baker.jpg
/Users/johnclark/Documents/WORK/GROUP PROCESS/GROUP TO BE PROCESSED/Stagecoach Image Pool/Colour Database/ Thumbnails_large/Alice Baker.jpg
/Users/johnclark/Documents/WORK/GROUP PROCESS/GROUP TO BE PROCESSED/Stagecoach Image Pool/Colour Database/ Thumbnails_small/Alice Baker.jpg
/Users/johnclark/Documents/WORK/GROUP PROCESS/GROUP TO BE PROCESSED/Stagecoach Image Pool/Colour Hi Res/Alice Baker.jpg
/Users/johnclark/Documents/WORK/GROUP PROCESS/GROUP TO BE PROCESSED/Stagecoach Image Pool/Hi Res/Alice Baker.jpg
/Users/johnclark/Documents/WORK/GROUP PROCESS/STAGECOACH SPOTLIGHT/BW Spotlight/Alice Baker.jpg
/Users/johnclark/Documents/WORK/GROUP PROCESS/STAGECOACH SPOTLIGHT/Colour Spotlight/Alice Baker.jpg”}

Hi,

the magic word is paragraph(s)

set theseFiles to paragraphs of (do shell script " /usr/bin/find ~ -name 'Alice Baker.jpg' -print -exec /usr/bin/ {} \\;")

You should note JPG will not be found with jpg (lowercase) and vice-versa

**Reason for edit: Stefan on the Quick Draw :slight_smile:

Oh my god, Stefan that is the second time today that you beat me to it :). I wiped one post already.
And I swear I did a reload just to make sure no posts have been done. I begining to think my browser is playing tricks on me.
:rolleyes:

Thanks chaps. I don’t do much text coercion so the help is appreciated

Mark
Is there any way I can find jpg and JPG in the same search?

Few different ways you can get jpg or JPG

This method uses a regula expression and will match other formats of jpg just as JpG jPg etc…

et theseFiles to paragraphs of (do shell script " /usr/bin/find ~ -name 'Alice Baker.[jJpPgG][jJpPgG][jJpPgG]' -print -exec /usr/bin/ {} \\;")

This method uses a complex find command searching for either condition.

set theseFiles to paragraphs of (do shell script " /usr/bin/find ~ \\( -name 'Alice Baker.jpg' -o -name 'Alice Baker.JPG' \\) -print -exec /usr/bin/ {} \\;")

And finally this method just turns the entire find case insensitive

set theseFiles to paragraphs of (do shell script " /usr/bin/find ~ -iname 'Alice Baker.jpg' -print -exec /usr/bin/ {} \\;")

Hope that helps.

Thanks James
Just what I needed