Spaces in the POSIX Path

I was getting errors on paths with spaces in folder names. Some research indicates that spaces need to be double escaped which has proven to be true when applied.

folder\ name only works when it’s folder\\ name
(to correctly display the backslashes on this forum, the second one is actually triple escaped)

Posixpath( adds just the one \

In what context is this necessary? I wrote the following command in Terminal, by dragging the file I wanted to open onto the Terminal window, and this is the path that it wrote.

The file opened without error.

Normally, two consecutive backslashes would be an escaped backslash. You would use it, if the file or folder name contained a backslash.

I pulled from the Automator folder in order to ensure its presence whenever I need to use it to join PDFs via a Panorama procedure. Calling it via AppleScript it only works with the double \. Otherwise I get a directory does not exist error.

Maybe AppleScript has some influence. ?? I’ve been working on how to call the Python script directly without AppleScript but have yet to fully work out the variables.

> AppleScript |||
> set inputFiles to {|||+lvPDFFiles+|||}
> set outputFile to |||+lvSavedPDF+|||
> set pdfFiles to ""
> repeat with p in inputFiles
> set pdfFiles to pdfFiles & " " & quoted form of POSIX path of p
> end repeat
> do shell script "/Applications/Panorama/Extensions/Enterprise/Public\\ Databases/Monitoring/ " & "-o " & quoted form of POSIX path of outputFile & pdfFiles
> -- do shell script "/System/Library/Automator/Combine\\ PDF\\ Pages.action/Contents/Resources/ " & "-o " & quoted form of POSIX path of outputFile & pdfFiles
> |||,ScriptResult

Yes it does. AppleScript also uses backslash as an escape character, which means that when you want to include a backslash in the text, you need to escape it with yet another backslash. So your first backslash was to escape the backslash which would become part of the shell script, and that backslash is to escape the space.