Curl output to file

I am trying to output a curl command to a file in applescript but I cannot get it to output to a specific file location. The script is as follows:

set path_to_desktop to path to desktop

set posix_path to POSIX path of path_to_desktop & "quotes.csv" as text

do shell script "curl " & "http://finance.yahoo.com/d/quotes.csv?s=IBM,DELL,DIA,QQQQ,AAPL&f=sl1d1t1c1ohgv" & "-o " & quoted form of posix_path

I can run the curl command in terminal and it outputs to the file but cannot get it to work in applescript. I have tried various form of the path to no avail. It seems to fall over as the path has a directory called “Network Data” and the curl output command does not seem to like the space in that directory.

Any help would be appreciated.

Hi,

quote the URL

quoted form of "http:. "

and in front of the -o switch there must be a space character

Thank you. That worked!

The correct URL to obtain the said file is:


set path_to_desktop to path to desktop
set posix_path to POSIX path of path_to_desktop & "quotes.csv" as text
do shell script "curl " & "'http://download.finance.yahoo.com/d/quotes.csv?s=IBM,DELL,DIA,QQQQ,AAPL&f=sl1d1t1c1ohgv'" & " -o " & quoted form of posix_path

Michael

Thank you. When I found out how to save the file to the location, I realised that the link was not right but thank you for pointing that out.