tell application “Finder”
make new Finder window to folder “Output” of (every folder whose name starts with “001”) of folder “Client” of disk “Production”
end tell
this the folder hierarchy I have:
disk Production → folder “Client” → folder “001_job” → folder “Output”
the above script does not work, it might be due to a wrong order of words in the script…
please see if you can do something about it
in essence “001” will eventually be a variable therefore it has to stay flexible
You need to loop through every folder to see if it’s name starts with the text.
Something like this (I’ve put the various bits in variables and added an error check in case the folder you find does not contain the correct sub-folder.)
--Finder open sub-folder
--John Maisey 17/4/5
property startFolder : "Production:Client:"
property finalFolder : "Output"
set theString to text returned of (display dialog "What does the folder name start with?" default answer "")
tell application "Finder"
set theFolders to folders of folder startFolder
repeat with myFolder in theFolders
if name of myFolder starts with theString then
try
make new Finder window to folder ((myFolder as text) & finalFolder)
on error theError
display dialog theError & return & "Cannot locate folder " & finalFolder & " in folder " & myFolder
end try
end if
end repeat
end tell