title: Syntax for using lftp to synchronize local folder with an ftp folder?
body: <p>I would like to synchronize two folders with each other. It should go two ways, always keeping the folders up to date (I use a regular cronjob). However, first I do not get the two way file transfer to work (it just downloads from the ftp and not the opposite).</p>
  
  <p>Secondly, it downloads the whole content from the ftp, even though the login information has been set up on the ftp so that access is only restricted to a specific folder. Why??</p>
  
  <p>Here is the code (thanks in advance!):</p>
  
  <pre><code>#!/bin/bash
  
  #get username and password
  USER=username
  PASS=password
  
  HOST="myftpserver.com/users/user1/" #here I have tried with only specifying server name as well as including whole path
  LCD="~/Desktop/localfolder/"
  RCD="users/user1/"
  
  lftp -c "set ftp:list-options -a;
  open ftp://$USER:$PASS@$HOST; 
  lcd $LCD;
  mirror -c --reverse --verbose $LCD $RCD" #I have tried a few different options w/o result
  </code></pre>