ftp upload folder help

I am an amateur applescripter and would appreciate any help with this or even a different way of doing it. My goal is to run this script in a cron.
I want to get this script that jj created for ftp upload to either upload a folder with PDF files in it or create a directory on the remote ftp site with the newName which would be created with this script. (I made some changes to jj’s script to get the files to send individually)
If I create the remote directory manually before I run the script it will move the files individually fine.
I get this error message when I try to move or create a directory.

do shell script “curl -T ‘/Volumes/archive/CREATE PDFs/Create FF Web Page/FF PAGES/FF06-10-2005/FF06-10-2005-A-FF@52-53.pdf’ ‘ftp://aberdeenftp:dt2serverx@10.212.90.215/FFonline/FF06-10-2005/’”
“curl: (9) Couldn’t cd to FFonline/FF06-10-2005” (the folder that it is supposed to create)


    if weekday of (current date) = Monday then
       copy ((offset of (the month of ((current date) + days * 1)) in ¬
           "jan feb mar apr may jun jul aug sep oct nov dec ") + 3) / 4 ¬
           as integer to mo
       if mo < 10 then copy "0" & mo as string to mo
       copy day of ((current date) + days * 1) to da
       if (day of ((current date) + days * 1) < 10) then copy "0" & da as string to da
       copy mo & "-" & da & "-" & (year of ((current date) + days * 1) as string) to shortdate
       
    else if weekday of (current date) = Tuesday then
       copy ((offset of (the month of ((current date) + days * 0)) in ¬
           "jan feb mar apr may jun jul aug sep oct nov dec ") + 3) / 4 ¬
           as integer to mo
       if mo < 10 then copy "0" & mo as string to mo
       copy day of ((current date) + days * 0) to da
       if (day of ((current date) + days * 0) < 10) then copy "0" & da as string to da
       copy mo & "-" & da & "-" & (year of ((current date) + days * 0) as string) to shortdate
       
    else if weekday of (current date) = Wednesday then
       copy ((offset of (the month of ((current date) + days * 2)) in ¬
           "jan feb mar apr may jun jul aug sep oct nov dec ") + 3) / 4 ¬
           as integer to mo
       if mo < 10 then copy "0" & mo as string to mo
       copy day of ((current date) + days * 2) to da
       if (day of ((current date) + days * 2) < 10) then copy "0" & da as string to da
       copy mo & "-" & da & "-" & (year of ((current date) + days * 2) as string) to shortdate
       
    else if weekday of (current date) = Thursday then
       copy ((offset of (the month of ((current date) + days * 1)) in ¬
           "jan feb mar apr may jun jul aug sep oct nov dec ") + 3) / 4 ¬
           as integer to mo
       if mo < 10 then copy "0" & mo as string to mo
       copy day of ((current date) + days * 1) to da
       if (day of ((current date) + days * 1) < 10) then copy "0" & da as string to da
       copy mo & "-" & da & "-" & (year of ((current date) + days * 1) as string) to shortdate
       
    else if weekday of (current date) = Friday then
       copy ((offset of (the month of ((current date) + days * 0)) in ¬
           "jan feb mar apr may jun jul aug sep oct nov dec ") + 3) / 4 ¬
           as integer to mo
       if mo < 10 then copy "0" & mo as string to mo
       copy day of ((current date) + days * 0) to da
       if (day of ((current date) + days * 0) < 10) then copy "0" & da as string to da
       copy mo & "-" & da & "-" & (year of ((current date) + days * 0) as string) to shortdate
       
    end if

    set newName to "FF" & shortdate

    set filePath to "servername:folder1:folder2:folder3:" & newName & ":"
    set remoteDir to "ftp://username:password@ipaddress/folder/" & newName


    upload(alias filePath, remoteDir)
    to upload(filePath, remoteDir)
       global baseLocalFolder, baseRemoteFolder, ftpHome, ftpDir
       global newName
       global shortdate
       script nesteed
           to guessNewDir(f) -- "/path/to/footest" --> /footest
               set prevTids to AppleScript's text item delimiters
               set AppleScript's text item delimiters to POSIX path of parent's baseLocalFolder
               set f to item -1 of f's text items
               set AppleScript's text item delimiters to prevTids
               return f
           end guessNewDir
           to breakURL(d) --> "ftp://user:pass@ftp.server.com/html/docs/" --> {"ftp://user:pass@ftp.server.com", "/html/docs"}
               set prevTids to AppleScript's text item delimiters
               set AppleScript's text item delimiters to "/"
               set ftpHome to "" & items 1 thru 3 of d's text items
               try
                   set ftpDir to "/" & items 4 thru -1 of d's text items
               on error
                   set ftpDir to "/"
               end try
               set AppleScript's text item delimiters to prevTids
               return {ftpHome, ftpDir}
           end breakURL
           
           to processUnknownItem(f, remoteDir)
               set f to f as text
               if f ends with ":" then
                   processFolder(f, remoteDir)
               else
                   do shell script "curl -T " & quoted form of POSIX path of f & space & quoted form of remoteDir
               end if
           end processUnknownItem
           to processFolder(f, remoteDir)
               set newDir to guessNewDir(POSIX path of f) --> "/footest"
               try --> avoid existing dirs
                   if newDir is not "" then do shell script "curl -Q " & quoted form of ("MKD " & parent's ftpDir & newDir) & space & parent's ftpHome
               end try
               set itemList to list folder alias f without invisibles
               repeat with i in itemList
                   processUnknownItem(alias (f & i), parent's ftpHome & parent's ftpDir & newDir)
               end repeat
           end processFolder
       end script
       set wasError to false
       try
           set filePath to filePath as Unicode text
           if filePath does not contain ":" then set filePath to POSIX file filePath as Unicode text
           if remoteDir does not end with "/" then set remoteDir to remoteDir & "/"
           
           if filePath ends with ":" then --> mirror dir
               --MAKE DIRECTORY "TEST" IN EXISTING "/HTML/DOCS"
               -- curl -Q "MKD /html/docs/test" ftp://user:pass@ftp.server.com
               
               set baseLocalFolder to filePath
               set baseRemoteFolder to remoteDir
               set {ftpHome, ftpDir} to breakURL(remoteDir) of nesteed --> {"ftp://user:pass@ftp.server.com", "/html/docs"}
               
               processFolder(filePath, remoteDir) of nesteed
           else
               do shell script "curl -T " & quoted form of POSIX path of filePath & space & quoted form of remoteDir
           end if
       on error msg number n
           set wasError to true
       end try
       set baseLocalFolder to missing value
       set baseRemoteFolder to missing value
       set ftpHome to missing value
       set ftpDir to missing value
       if wasError then error msg number n
       return
    end upload

    property |version| : 1.0
    property author : "Pescados Software ? PescadosWeb.com"
    property |date| : date "Friday, September 17, 2004 10:20:27 PM"
    property license : "freeware, open-source"

Browser: Netscape/7.2
Operating System: Mac OS X (10.3.9)

Is the directory getting created? What do the event responses look like when the mkd command is issued?

A directory doesn’t get created, that’s why it can’t cd to it. Since I didn’t write this script I really don’t fully understand what it is doing, and I’m not much of a script writer, trying though. I thought that it would create a directory if it doesn’t exist. Here is the event log. Thanks for any help

tell current application
	current date
		date "Wednesday, June 15, 2005 9:50:43 AM"
	current date
		date "Wednesday, June 15, 2005 9:50:43 AM"
	current date
		date "Wednesday, June 15, 2005 9:50:43 AM"
	current date
		date "Wednesday, June 15, 2005 9:50:44 AM"
	offset of June in "jan feb mar apr may jun jul aug sep oct nov dec "
		21
	current date
		date "Wednesday, June 15, 2005 9:50:44 AM"
	current date
		date "Wednesday, June 15, 2005 9:50:44 AM"
	current date
		date "Wednesday, June 15, 2005 9:50:44 AM"
	list folder alias "archive:CREATE PDFs:Create FF Web Page:FF PAGES:FF06-17-2005:" without invisibles
		{"FF06-17-2005.txt "}
	do shell script "curl -T '/Volumes/archive/CREATE PDFs/Create FF Web Page/FF PAGES/FF06-17-2005/FF06-17-2005.txt ' 'ftp://username:password@ipaddress/FFonline/FF06-17-2005/'"
		"curl: (9) Couldn't cd to FFonline/FF06-17-2005"


So I was finally able to create a directory but now I want to be able to name the directory differently every week according to the weekday and date it runs.
I’m sure it’s the path that I’m trying to find but not sure what to use for it??

I replaced this part

if filePath ends with ":" then --> mirror dir
--MAKE DIRECTORY "TEST" IN EXISTING "/HTML/DOCS"
-- curl -Q "MKD /html/docs/test" ftp://user:pass@ftp.server.com

with this


if filePath ends with “:” then → mirror dir
–MAKE DIRECTORY “TEST” IN EXISTING “/HTML/DOCS”
try
–THIS ONE WORKS
do shell script “curl -Q ‘MKD /FF06-17-2005’ ftp://user:password@ipaddress
–THIS ONE DOESN’T
do shell script “curl -Q ‘MKD /’” & quoted form of POSIX path of filePath & quoted form of POSIX path of mkremoteDir
end try

Okay so I finally got this to work this is what I changed. Seems pretty simple after I look at it.

if filePath ends with ":" then --> mirror dir
			--MAKE DIRECTORY "TEST" IN EXISTING "/HTML/DOCS"
			try
				do shell script "curl -Q 'MKD /" & newName & "'" & space & "ftp://username:password@ftp.site"
			end try