FTP files through curl
FTP files through curl
- Subject: FTP files through curl
- From: "Rajat Srivastava" <email@hidden>
- Date: Tue, 12 Apr 2005 08:25:50 -0400
Hi,
I was trying to upload files to ftp server through the script below. It was running
fine, till I was connecting it to ftp server on local intranet, but it failed when i
connected to ftp server on the internet and gives the error curl:(7) connect failed.
I know it is not due to firewall or proxy settings and that server can be connected
by fetch (or any ftp tool). I am using Mac OS X 10.3.5. I am new to applescript.
on simpleFtpUpload(remoteURL, localFile, userName, userPasswd)
try
set {od, AppleScript's text item delimiters} to {AppleScript's text item
delimiters, ":"}
set parentFolder to (text items 1 thru -2 of (localFile as string)) as
string
set AppleScript's text item delimiters to od
set localPosixPath to quoted form of POSIX path of localFile
set uploadFileName to do shell script "basename " & localPosixPath
set uploadDirectory to quoted form of POSIX path of parentFolder
-- curl --upload-file SOMEFILE ftp://SERVER.com --user MYUSER:
THEPASSWD
-- must be IN the directory of the file you want to upload
set myCommand to "cd " & uploadDirectory & ";" & "curl --upload-file "
set myCommand to myCommand & quoted form of uploadFileName
set myCommand to myCommand & " " & remoteURL
set myCommand to myCommand & " --user " & userName & ":" &
userPasswd
set myCommand to myCommand & " " & "--write-out " &
"%{size_upload}"
set myCommand to myCommand & " --quote -quit"
set uploadResult to do shell script myCommand
on error errmsg number errNum
error "simpleFtpUpload FAILED: " & errmsg number errNum
end try
end simpleFtpUpload
Regards,
Rajat Srivastava
_______________________________________________
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