Hello…New to Macs and applescipt/terminal
I need a way to find out if a specific folder/directory (not a disk or drive) exists at the root of /Volumes. The closest I’ve got is something like: tell application "Finder"
set dirList to {do shell script "ls /Volumes"}
repeat with i from 1 to count of dirList
display dialog (item i of dirList)
end repeat
end tell
but that gives me one record as a concatenation, and it seems a bit unwieldy.
Any suggestions?
How bout like this?
tell application "Finder"
if exists folder "path to folder name" then -- example: "HD:Applications"
-- the folder exists do whatever
else
-- the folder does NOT exist
end if
end tell
Hi,
the ls command returns the names of contents of the folder, separated by a new line character.
the paragraph keyword coerces the result to a list.
set dirList to paragraphs of (do shell script "ls /Volumes")
repeat with i in dirList
display dialog i
end repeat
Note: The Finder is no needed
Very nice. Thank you both!