How to change AppleScript path to a Terminal-style path?

Use quoted form of the POSIX path of input. Without the quoted form of part, it won't handle funny characters (like spaces) in filenames correctly. See this Apple technote.


Ok...this was easier than I had realized. After some Googling, it looks like what I need here is the POSIX path of command. This converts a given path to a Unix style path, which is the type of path you would see/use in Terminal. So:

POSIX path of input

Gives me a path like:

/Users/Matthew/Documents/Programming/Apple Scripts/

It seems to take into account that you just need a / at the beginning of the path, rather than the hard drive name. It does not, however, escape \ spaces (or handle special characters) in the path. So, as the other answer here mentions, you need to place the path in quotes ( " or ' ) in order for those spaces (or special characters) to be interpreted literally. You accomplish this by using quoted form of. Here it is:

quoted form of the POSIX path of the input
-- gives a path like: '/Users/Matthew/Documents/Programming/Apple Scripts/'