Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How can I create a directory on my server using FTP in applescript?

Hi

I have created a script which successfully uploads files to my server using FTP and a curl command.

The one thing I haven't worked out how to do is how to create a directory on my server using applescript. At the moment I have to manually create the correct directory for the script to work, but would like to be able to automate everything.

Would this be possible?

Thanks

Nick

Macbook Pro, Mac OS X (10.6.4), 2.66 GHz Intel Core i7 8GB RAM

Posted on Feb 20, 2011 8:52 AM

Reply
7 replies

Feb 20, 2011 10:25 AM in response to Arkouda

Thanks Bernard.

I have tried that and still get the error message:

"curl: Can't open '--ftp-create-dirs'!
curl: try 'curl --help' or 'curl --manual' for more information
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed

0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0
curl: (9) Server denied you to change to the given directory"



The other relevant parts of the script are:

set ftp_url to "ftp. ****.org.uk/artists/" & artistName2 & "/assets/"
set ftp_username to " *****@*****.org.uk"
set ftp_password to " ****"
set ftp_entire to ftp_username & ":" & ftp_password & " ftp://" & ftp_url

set outPath to outputFolder & fileCounter & ".jpg"

and then...

do shell script ("curl -T --ftp-create-dirs " & outPath & " -u " & ftp_entire)

Like I said, all works fine when the directories are already in place. I have permissions for the artists folder set to "777", i.e. writable. Because the script is trying to create two directories at once, i.e. "artistName2" and then "assets" under it, I wondered if this was significant, but then I tried with just one new directory, and still got the error.

Feb 20, 2011 10:43 AM in response to Arkouda

do shell script ("curl -T --ftp-create-dirs " & outPath & " -u " & ftp_entire)


The -T switch tells curl the file to upload, which has to be the next argument on the command line, therefore this is getting interpreted as telling curl to upload the file '--ftp-create-dirs', hence the failure.

The solution to to just re-order the parameters:

do shell script ("curl --ftp-create-dirs -T " & outPath & " -u " & ftp_entire)


(that is, assuming that outPath is the path to the file to be uploaded)

How can I create a directory on my server using FTP in applescript?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.