convert file path to POSIX

trying to convert this:
/Users/shawnbrady/Documents/Adobe/Premiere Pro/14.0/CBN Feat.prproj

to this:
Macintosh HD:Users:shawnbrady:Documents:Adobe:Premiere Pro:14.0:CBN Feat.prproj

this works but there is no variable

display dialog "" default answer "paste the path here"
set the_path to text returned of the result as string
set z to do shell script "ls  '/Users/shawnbrady/Documents/Adobe/Premiere Pro/14.0/CBN Feat.prproj'"
set cc to POSIX file z as string
display dialog cc as string -- Macintosh HD:Users:shawnbrady:Documents:Adobe:Premiere Pro:14.0:CBN Feat.prproj

How do I make the text returned from the 1st dialog box (users/shawnbrady/etc)
a variable that works with the ls command

this does not work:

display dialog "" default answer "paste the path here"
set the_path to text returned of the result as string
set z to do shell script "ls" &  the_path
set cc to POSIX file z as string
display dialog cc as string

–Have you tried:


set fp to ("/Users/shawnbrady/Documents/Adobe/Premiere Pro/14.0/CBN Feat.prproj" as POSIX file) as text

return fp

If it begins with a slash like that, it’s a POSIX path, which is what ls requires. The only catch is that it needs to be quoted in case things like spaces in the path, which you get by asking for the quoted form of the path. So:

display dialog "" default answer "paste the path here"
set the_path to text returned of the result
set z to do shell script "ls " & quoted form of the_path

The 3rd code line should include the SPACE after the ls:

set z to do shell script "ls " &  quoted form of the_path

True. I’ve amended my post above.