• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Applescript to do SCP?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Applescript to do SCP?


  • Subject: Re: Applescript to do SCP?
  • From: Axel Luttgens <email@hidden>
  • Date: Sun, 07 May 2006 12:35:45 +0200

On 5/05/06 23:18, Patrick Besong wrote:

I saw your post on http://lists.apple.com/archives/applescript-users/ 2003/Apr/msg01263.html and was wondering if you ever got Applescript to work with SCP? I am trying to do the same thing right now with no luck. When it asks for a password, there seems to be no way to pass it.

Ouch! Some kind of time machine? ;-)

Well, I never tried it seriously...
But now that you asked, I just did some experiments with expect.
Here follows a quick and dirty script, that should just be viewed as a skeleton.


   set src to "/Volumes/Data/aS"
   set dst to "luttgens@127.0.0.1:/Volumes/Data/aD"
   set passwd to "mypassword"

   set scrpt to "expect <<EXPECTSCRIPTEND
   spawn scp -q " & src & " " & dst & "
   expect -re \"password:\\ $\"
   send " & passwd & "\\r
   expect eof
   EXPECTSCRIPTEND
   "

   do shell script scrpt


Note 1:
The above holds for 10.3.9, where scp's prompt for the password looks like:
luttgens@127.0.0.1's password:
(with a space after the column)
On 10.4, the prompt is "Password:", so that the regular expression needs to be adapted accordingly:
expect -re \"Password:$\"


Note 2:
The above assumes that know_hosts already contains the relevant host key.

HTH,
Axel

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Applescript to do SCP?
      • From: Björn Lundin <email@hidden>
  • Prev by Date: Re: Scripting TextEdit
  • Next by Date: Re: Applescript to do SCP?
  • Previous by thread: Re: Scripting TextEdit
  • Next by thread: Re: Applescript to do SCP?
  • Index(es):
    • Date
    • Thread