From: birre on
On 2008-05-02 23:56, Holz wrote:
> Hi all
>
> Looking for some FTP script help.
> I am trying to automate getting files from my web site and send them
> directly to a printer.
> Here is what I have:
> ftp
> open ftp.mydomain.com
> user ftpuser
> ftp pwd
> cd /home/myusername/public_html/uploads/files
> lcd /home/me/test
> binary
> mget /files
> # I am failing here..
> # I want to delete all present files.
> disconnect
> bye
>
> How and where would I stick the printing line, if possible at all?
>
>
>

Instead of making ftp scripts you can use .netrc and make a macro
named print for example.

A macro named init will be run every time you call ftp.

The file .netrc must be protected from other users, or it refuse to work,
chmod 600

Example of ~/.netrc

machine ftp.mydomain.com login ftpuser password the_password
macdef print
prompt off
binary
cd /home/myusername/public_html/uploads/files
lcd /home/me/test
mput * (I guess it was put and not get)
! mv * ../uploaded (rm is maybe a bit unsafe)
bye
<empty line to end this macro>

Then call the macro with:
echo \$print | ftp ftp.mydomain.com

and it do what you told it.

/bb