image
image

Go Back   macosx.com > Design, Media, Programming & Scripting > Software Programming & Web Scripting

Reply
 
Thread Tools
  #1  
Old August 7th, 2004, 03:48 PM
Registered User
 
Join Date: Sep 2003
Posts: 374
Thanks: 0
Thanked 0 Times in 0 Posts
freaky is on a distinguished road
Example of how to upload a file using AppleScript & UNIX Shell?

Is using "do shell script" and cURL really a better way to upload a file than URL Access Scripting? If so, can somebody give me a simple example of how to upload a small text file with this method?
__________________
Mac Pro [2 GHz Quad Xeon, 3 GB RAM, 3 x 250 GB drives]
MacBook [2 GHz Intel Core 2 Duo, 2 GB RAM, 80 GB drive]
Reply With Quote
  #2  
Old August 7th, 2004, 03:57 PM
scruffy's Avatar
Notorious Olive Counter
 
Join Date: Dec 2000
Location: Soviet Canuckistan
Posts: 1,726
Thanks: 0
Thanked 0 Times in 0 Posts
scruffy is on a distinguished road
simple example for ftp:

curl --upload-file foo.txt ftp://some.server/some/folder/

You can also add options like
--user username:password

As always, rtfm.
__________________

What is the robbing of a bank compared to the founding of a bank?
-- Bertold Brecht

Last edited by scruffy; August 7th, 2004 at 03:58 PM. Reason: no I really did mean : followed by p, not a smiley
Reply With Quote
  #3  
Old August 7th, 2004, 04:23 PM
Registered User
 
Join Date: Sep 2003
Posts: 374
Thanks: 0
Thanked 0 Times in 0 Posts
freaky is on a distinguished road
So instead of doing this:

Code:
tell application "URL Access Scripting"
    upload file.txt to "ftp://login:password@server.com replacing yes without binhexing
end tell
Would this be correct or do I need to run it inside of a tell statement?

Code:
curl --upload-file file.txt --user login:password ftp://server.com
Can you send me the link to the manual? All I have is is an OReilly book and I can't find a manual for AppleScript on apple.com/applescript or on Google. I guess they have one just like the PHP manual??

Thanks for your help.
__________________
Mac Pro [2 GHz Quad Xeon, 3 GB RAM, 3 x 250 GB drives]
MacBook [2 GHz Intel Core 2 Duo, 2 GB RAM, 80 GB drive]
Reply With Quote
  #4  
Old August 7th, 2004, 06:28 PM
scruffy's Avatar
Notorious Olive Counter
 
Join Date: Dec 2000
Location: Soviet Canuckistan
Posts: 1,726
Thanks: 0
Thanked 0 Times in 0 Posts
scruffy is on a distinguished road
Sorry, I just meant the curl manpage - lots and lots of useful options (how to use proxies, upload http forms, etc. etc.)

The only manual for applescript I have is the one that came with the developer tools cd - it's installed at /developer/documentation/applescript.

I don't know about how to wrap that into applescript. I'd just write a shell script and run it in the terminal, cuz that's what I know how to do...
__________________

What is the robbing of a bank compared to the founding of a bank?
-- Bertold Brecht
Reply With Quote
  #5  
Old August 7th, 2004, 08:32 PM
NSCoder
 
Join Date: Oct 2002
Posts: 198
Thanks: 0
Thanked 0 Times in 0 Posts
anarchie is on a distinguished road
do shell script "curl --upload-file file.txt --user login:password ftp://server.com"
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off
Forum Jump


All times are GMT -5. The time now is 11:29 AM.


Mac Support® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2000-2008 DigitalCrowd, Inc.