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.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Getting path of parent folder of a file during a workflow execution

How can I get the parent folder/directory of a file during the execution of a workflow? I cant't find any actions i Automator that will give me this.

I want to make a general applicable automated workflow. The path can not be hardcoded in the workflow as different files and folders will be worked on each time the workflow is run.

The input to the workflow is a file or list of files. I want to be able to retrieve the path of the parent folder of these files at runtime.

Will I have to do this through AppleScript? If so, then how?

(in case you have seen my first post on this; it seems I wasn't specific enough so people didn't understand what I want to do. Therefore this second post. Sorry for the iconvenience)

Macbook Core 2 Duo 2 GHz, PM G4 750 mhz, Mac OS X (10.5.2)

Posted on May 23, 2008 8:22 AM

Reply
Question marked as Top-ranking reply

Posted on May 23, 2008 11:43 AM

Hi anilsen!
If all selected files are within the same folder, it would be like this:

For example:
• Get Specified/Selected Finder Objects
• Run AppleScript

on run {input, parameters}

tell application "Finder"
set output to (container of item 1 of input) as alias

end tell
return output
end run


Spazek
2 replies
Question marked as Top-ranking reply

May 23, 2008 11:43 AM in response to anilsen

Hi anilsen!
If all selected files are within the same folder, it would be like this:

For example:
• Get Specified/Selected Finder Objects
• Run AppleScript

on run {input, parameters}

tell application "Finder"
set output to (container of item 1 of input) as alias

end tell
return output
end run


Spazek

Getting path of parent folder of a file during a workflow execution

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.