Subject: | |
From: | |
Reply To: | |
Date: | Wed, 7 Jun 2006 20:34:07 -0400 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
On Jun 7, 2006, at 14:00, Stockly, Ed wrote:
> I've got a shell script that I've been using on a server that's
> called by intellitune after a photo is processed. It needs to FTP a
> file to a specific address. (This is all internal, behind our
> firewall and security is not a big concern.)
>
> If I type the script in to the terminal it works, which is good,
> because that's also how I'm learning shell scripting and debugging
> these scripts.
>
> The problem is that if I run the identical command in a "do shell
> script foo" it fails. As a workaround I'm using terminal, but I'd
> prefer to not call up another app and would prefer to just run it
> as a do shell script.
> Is this doable? Is there a way to make the do shell script and
> terminal run consistently?
>
> Here's the script I'm having trouble with:
>
> set ftpShellScript to "ftp -d -v -u ftp://" & remoteUserid & ":" &
> remotePassword & "@" & remoteServer & ":21" & remotePath & fileName
> & " " & localFile
> tell application "Terminal"
> do script ftpShellScript
> delay 3
> set shellScriptLog to contents of window 1
> end tell
> Ed
It works!
At least it works here.
I believe it works there as well... you get an error message, but you
should get the same error message in Terminal. Terminal simply by-
passes it.
The problem is, you would be downloading files to the root directory.
To download the files to your user root directory try the following
set ftpShellScript to "cd ~/; ftp ftp://" & remoteUserid & ":" &
remotePassword & "@" & remoteServer & ":21" & remotePath & fileName:
do shell script ftpShellScript
If you use the -u option, you will get the error you are getting now.
And, you will not download the file.
The command above copies the file remotePath /fileName in the ftp
host to ~/fileName in your Mac.
Deivy
|
|
|