Re: FTP and Applescript
Re: FTP and Applescript
- Subject: Re: FTP and Applescript
- From: Doug McNutt <email@hidden>
- Date: Tue, 21 Aug 2007 13:09:30 -0600
At 13:41 -0400 8/21/07, Dana Hill wrote:
>I know I didn't ask the original question, but if you wouldn't mind sharing your 'drag and drop' implementation, I'd be most appreciative. Thank you!
-- This one will list the contents of a private FTP site
-- Save as application with run only option
property UserName : "username"
property UserPass : "password"
property FTPpath : "ftp.macnauchtan.com"
set theScript to "/usr/bin/curl -l ftp://"
set theScript to theScript & UserName
set theScript to theScript & ":" & UserPass
set theScript to theScript & "@" & FTPpath & "/"
set stdout to do shell script theScript
display dialog stdout
-- This one will send dropped files to a private FTP site.
-- Save as application
property UserName : "username"
property UserPass : "password"
property FTPpath : "ftp.macnauchtan.com"
on open (argList)
set theScript to "/usr/bin/curl"
set theScript to theScript & space & "ftp://"
set theScript to theScript & UserName
set theScript to theScript & ":" & UserPass
set theScript to theScript & "@" & FTPpath & space & "-T" & space
-- display dialog theScript
repeat with theAlias in argList
set thePath to quoted form of POSIX path of theAlias
set stdout to do shell script theScript & thePath
end repeat
end open
You'll have to provide username, password, and an ftp site address. If a subdirectory is included you should terminate the FTPpath item with a "/" (solidus, forward slash, not a backslash.)
The use of inline passwords this way would make Steve drop his load but it's probably as good as simple FTP itself. Some improvement can be had by creating a file called .netrc (note the leading dot) in your home directory. In it put domain names, usernames, and passwords for various sites on separate lines. (Google for .netrc for details.) If that file is present, and set to read by user only, curl will use them without any user:password@ if you add a -n option to the command.
--
--> From the U S of A, the only socialist country that refuses to admit it. <--
_______________________________________________
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