shell scripts with spaces

my commands work in terminal but for some reason i cannot get them to work in scripteditor.
ive tried with a / befor the space and also tried with " " around it and still no luck.

how do i get around the spaces in these folder names ???

Try “” instead of “/”.

sorry the / in my post is i typo

i have been trying

ls -F -R /Volumes/Volume Name/

Would work fine from the terminal


set myShell to "ls -F -R /Volumes/Volume Name/"

Will not even compile in your AS editor. You’d probably get an error that bespeaks of an unknown token as the frontslash tells applescript to treat the next character specially.

One way to do this, try:

set myNaughtyVolume to "Volume" & "\" & " Name/"  as string
set myShell to "ls -F -R /Volumes/" & myNaughtyVolume as string
do shell script myShell

If this doesn’t get you going - try posting what you are attempting to do.

Best regards

or better still, use ‘quoted form of’ the string to let the OS handle quoting/escaping/parsing the command into a format the shell can understand.

 set thePath to "/folder with spaces/sub folder"
do shell script "ls -l " & quoted form of thePath

Or, if you are in the position to, and are able to without mucking things up, just rename the offending folder or file to something without problem characters. I’ve had to do this in the past - easier than trying to code around it. I’ve continued to practice this in all subsequent resources.

Take care,

this is what im trying to do

cp ~/library/preferences/adobe illustrator cs settings/monop/office/adobe illustrator prefs ~/library/preferences/adobe illustrator cs settings/adobe illustrator prefs

this is what terminal brings when i drag and drop

cp ~/Library/Preferences/Adobe Illustrator CS Settings/Adobe Illustrator Prefs /Library/Preferences/Adobe Illustrator CS Settings/monop/Office/Adobe Illustrator Prefs

does anyone know how that will work im my script^^^^^