• 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: curl ftp, get 'Cant Open' msg
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: curl ftp, get 'Cant Open' msg


  • Subject: Re: curl ftp, get 'Cant Open' msg
  • From: Graff <email@hidden>
  • Date: Tue, 19 Oct 2004 21:51:02 -0400

You need to use POSIX-style file paths when you are using the shell. Instead of:
HD:index.html


You would do:
    /Volumes/HD/index.html

If HD was your startup drive then you could just do:
    /index.html

You can convert a Mac-style path to a POSIX-style path through the Standard Additions OSAX class "POSIX file"
----
set macPath to file "HD:index.html"
set posixPath to posix path of macPath
----


While you are at it you probably should have Applescript quote that for you:
----
set macPath to file "HD:index.html"
set posixPath to quoted form of posix path of macPath
----


Then your script would become something like
----
set macPath to file "HD:index.html"
set posixPath to quoted form of posix path of macPath

set userPass to quoted form of "username:password"

do shell script "curl ftp://ipaddress -# -T " & posixPath & " -u " & userPass
----


You are almost always better off having AppleScript do the quoting of a string rather than you doing it yourself. This is because AppleScript automatically handles stuff like escape characters and quotes when it is quoting a string.

For more information about the AppleScript "do shell script" command, see this technote:
<http://developer.apple.com/technotes/tn2002/tn2065.html>


- Ken

On Oct 19, 2004, at 9:02 PM, Jim Main wrote:

I appreciate Johny Applescript and Adam Wuellner's help with escaping quotes - so simple.

One more hangup, it seems like this should be working. I've run the following from terminal (I'll put it in a script once I get it working):

curl ftp://ipaddress -# -T "HD:index.html" -u "username:password"

The error I get is:

Can't open 'HD:index.html'!

Everyone has read/write permissions to that file, the path is correct (where 'HD' is the drive's name, and 'index.html' is a file in it at the root level). Any suggestions?

_______________________________________________ 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
References: 
 >curl ftp, get 'Cant Open' msg (From: Jim Main <email@hidden>)

  • Prev by Date: Re: [OT] Question on Terminal
  • Next by Date: Re: Monitor brightness and UI Scripting
  • Previous by thread: curl ftp, get 'Cant Open' msg
  • Next by thread: Scripting iCal toDo's
  • Index(es):
    • Date
    • Thread