Ramaraj T
Ramaraj T

Reputation: 5230

Get file Path from AppleScript

I need to get the file path of the chosen folder from AppleScript. I am using the following code to do this.

    --Display selection window
    set source_folder to choose folder with prompt "Please select directory."
    --Get the path of the folder
    set item_list to get the path of every disk item of source_folder

I am getting a file path like this:

File:Path:To:the:fodler

What I want is:

File/Path/To/the/folder

Upvotes: 5

Views: 9436

Answers (2)

adayzdone
adayzdone

Reputation: 11238

Try:

set source_folder to choose folder with prompt "Please select directory."

tell application "System Events"
    set item_list to POSIX path of every disk item of source_folder
end tell

Upvotes: 5

keyboardP
keyboardP

Reputation: 69372

Try getting the POSIX path instead:

set item_list to get the POSIX path of every disk item of source_folder

Upvotes: 3

Related Questions