Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a list of files changes, example:

/opt/lampp/htdocs/project/index.php
/opt/lampp/htdocs/project/css/styles.css
/opt/lampp/htdocs/project/css/styles001.css
/opt/lampp/htdocs/project/system/model/core.php
/opt/lampp/htdocs/project/system/controllers/admin/users.php

How can I do to upload them in one shot via FTP using Linux?

share|improve this question

You can find an example of how to do this here.

From the page itself:

## upload the files
INPUT=/path/to/list_of_files_to_upload
LOCALBASE=/home/pete/website        #local directory that corresponds to the root of the website

for ITEM in $(cat $INPUT); do
      FILE=$(basename $ITEM)
      LOCALDIR=$(dirname $ITEM)

      if  [ "$LOCALDIR" == "$LOCALBASE" ]; then
                REMOTEDIR="/"
      else
              REMOTEDIR=${LOCALDIR#$LOCALBASE}
      fi

  ## ftp starts here
  ftp -v -n $SERVER <<END_OF_SESSION
  user $USER $PASSW
  $FILETYPE
  lcd $LOCALDIR
  cd $REMOTEDIR
  put $FILE
  bye
  END_OF_SESSION
done
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .