4
votes

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

2

2 Answers

4
votes

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
3
votes

Try getting the POSIX path instead:

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