Help with SCP script.

I’m in the process of writing a script that will copy files to various computer on my nertork using the “SCP” command.

I’ve managed to sort most of it out (with help from this forum) but I’m stuck at copying files with spaces in the name here’s what I’ve got so far:


set the_file to "/Users/me/Desktop/Disc Eraser.app"
set the_Name to "/MediaFiles/Disc Eraser.app"

do shell script ("scp -B -r -p " as Unicode text) & quoted form of the_file & (" install@192.168.38.46:" as Unicode text) & quoted form of the_Name

When I run the scipt it errors with this: “scp: ambiguous target”

if I change the “set the_Name to “/MediaFiles/Disc Eraser.app”” to set the_Name to “/MediaFiles/DiscEraser.app” with no Space between Disc & Eraser the script works.

How do I get the script to accept the space?

keep adding a slash infront of the space till it works
you’ll at least need one for each level
1 for applescript
1 for shell
1 for ssh
/MediaFiles/Disc\\ Eraser.app
or i could be wrong you may need more.

Thanks for the post but I couldn’t get it to work.

Also the code I posted is a snippet of the whole script. The first part of the script asks you to choose the file or Folder to copy, so adding \ to the file name won’t work, unfortunatley.

Thanks again.