Getting the path of the parent folder of a file?
Will I have to do this through AppleScript? If so, then how?
Anders
Original iBook, PM G3 266 mhz
You can make a difference in the Apple Support Community!
When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.
When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.
Original iBook, PM G3 266 mhz
on open filefolderlist
repeat with itemNum from 1 to number of items in filefolderlist
tell application "System Events"
set thePath to POSIX path of (container of (item itemNum of filefolderlist))
end tell
display dialog thePath
end repeat
end open
on run {input, parameters}
set pathList to {}
repeat with itemNum from 1 to count of input
tell application "System Events"
copy POSIX path of (container of (item itemNum of input)) to end of pathList
end tell
end repeat
return pathList
end run
on run {input, parameters}
tell application "System Events"
set thePath to POSIX path of (container of (item 1 of input))
end tell
return thePath
end run
Try this bash script.
It takes each file path send to it and outputs the parent folder of each one.
for f in "$@"
do
echo "$(dirname "$f")"
done
Getting the path of the parent folder of a file?