# automatically upload files to a ftp-server



## ogg (Sep 24, 2002)

i want to create a shell-script to automatically upload a litte tar-archiv to the webserver. i have typing the following command:

ftp -u ftp://[ip-adress] user [username] password [mypassword] /source/archiv.tar /target/archiv.tar

it doesn't work!

can anyone give me some help?

thanks!


----------



## TBoNe (Sep 24, 2002)

Try using this:

Create a ".netrc" file that contains the following (the dot denotes invisable file) in the directory that your ftp script is.

machine     ftp.server.name
login           account_login
password    password

set the permissions for the owner to have read and write access only
  -rw-------

then create your shell script to ftp to the "machine" name in that file, it will automatically log in and perform whatever other commands you have in the script.

Hope that was clear enough, good luck!


----------



## ogg (Sep 25, 2002)

i have downloaded the ncftp-package (listed on versiontracker.com) and used the ncftpput command, it rocks! very simple, more powerfull than the default ftp-client in os x.


----------



## gumse (Sep 25, 2002)

You can also use curl to upload to a ftp server:

curl -T filename -u usernameassword ftp://somehost.com/somedir/filename


----------



## ogg (Sep 25, 2002)

Thanks to gumse, great it works!

another question: how can i password-protect my tar-file? is there a way with zip, compress or anything else?


----------

