I'm looking for a way/code to select a folder within a specific folder that contains part of a string from a variable
I have folderA and within folderA are numerous folders. All the folders within folderA start out with a 5 digit number followed by an "_" and then a short description. ie, 12345_Folder Test 1, 54321_Folder Test 2, 99999_Folder Test 3, etc...
tell application "Finder"
set folderA to folder "FolderA" of folder "Desktop" of folder "MacUser" of folder "Users" of startup disk
set jobNum to text returned of (display dialog "Enter 5 Digits Only:" default answer "")
open folderA
set selected_item to (folder whose name contains jobNum in folderA) -- This is what's failing for me.
-- from here on I would like to do other things such as run other parts of a script.
end tell
---Script Error Message
Can’t get folder whose name contains jobNum of folder "FolderA" of folder "Desktop" of folder "prepress_js" of folder "Users" of startup disk of application "Finder". ----
Any help is greatly appreciated!
Try this line:
set selection to item 1 of (get every folder in folderA whose name contains jobNum) -- This is what's failing for me.