Ftp-automation

From s23
Jump to navigation Jump to search

if you want automatically upload files via FTP with a bash-script and if you don't like the .netrc_ftp-method you can do it like this:

#!/bin/bash
  # autoftp.sh
  lokal_file=/<path>/<to>/<local>/<file>
  remote_file=<path>/<and>/<name>/<of>/<the>/<destination-file>
  # ... /tmp/test1 erzeugen
  ftp -n <<EOFTP
    open <ftp-server>
    user <username> <password>
    bin
    put $lokal_file $remote_file
    quit
  EOFTP