• 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 shell script SCP?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: applescript shell script SCP?


  • Subject: Re: applescript shell script SCP?
  • From: Stan Cleveland <email@hidden>
  • Date: Fri, 12 Dec 2008 15:20:38 -0800
  • Thread-topic: applescript shell script SCP?

Title: Re: applescript shell script SCP?
On 12/8/08 4:46 PM, "Mr. Dan Pouliot" wrote:

> My goal is to sftp a file to a server (curl doesn't support sftp).
> The problem is that SCP requires that the password be typed when  
> prompted, after the initial command.

Dan,

Among all the other options you have available, here’s an up-to-date version of my earlier suggestion, just in case you might find it useful. I've upgraded to the latest version of the Net-SFTP rubygem (v2.0.1) and done some testing. The code below uses SFTP to upload a file to a remote location:

set localSource to "/Users/stanc/Desktop/testfile.pdf"
set remoteTarget to "/Dir1/Dir2/testfile.pdf"
try
   set scriptResult to do shell script ("ruby -rubygems -e \"require 'net/sftp' ; " & ¬
        "Net::SFTP.start('192.168.191.5', 'userid', :password => 'blahblah') do |sftp| ; " & ¬
        "sftp.upload!(" & quoted form of localSource & ", " & quoted form of remoteTarget & "); end\"")
    return "" -- file upload succeeded
on error errText number errNum
   return errText -- file upload failed
end try

Try as I might, I couldn’t get Mark’s suggestion to work, which is to specify both dependencies (rubygems and net/sftp) as –r command options. So the net/sftp dependency was done as a "require" within the command text. Oh well.

Stan C.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: applescript shell script SCP?
      • From: "Mark J. Reed" <email@hidden>
References: 
 >Re: applescript shell script SCP? (From: Stan Cleveland <email@hidden>)

  • Prev by Date: Re: How to add keywords to photos in iPhoto?
  • Next by Date: Re: applescript shell script SCP?
  • Previous by thread: Re: applescript shell script SCP?
  • Next by thread: Re: applescript shell script SCP?
  • Index(es):
    • Date
    • Thread