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

Hi,

if the new directory is part of the destination file path, pass the --ftp-create-dirs switch

Yes, it is.

I have been trying to use --ftp-create-dirs, in the following form:

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

but I still get the following error when running the script:

"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"

I have permissions for the folder that I am creating the directories in set to “777”

try the syntax


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

the -u switch expects username and password colon separated and
the -T switch should come before the source path

I have now worked out that the correct syntax is:

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

Thanks for your help

Nick

I’m not sure, but I think the destination (server URL) must be the full path including the file name