Why lftp mirror --only-newer does not transfer "only newer" file?

Noah Kobayashi picture Noah Kobayashi · Jul 15, 2012 · Viewed 18.6k times · Source

I want to automate to upload files of my websites. But, remote server does not support ssh, so I try lftp command below instead of rsync.

lftp -c "set ftp:use-mdtm no && set ftp:timezone -9 && open -u user,password ftp.example.com && mirror -Ren local_directory remote_directory"

If local files are not changed, no files are uploded by this command. But, I change a file and run the command, all files are uploaded.

I know lftp/ftp's MDTM problem. So, I tried "set ftp:use-mdtm no && set ftp:timezone -9", but all files are uploaded though I changed only one file.

Is anyone know why lftp mirror --only-newer does not transfer "only newer" file?

Answer

p6majo picture p6majo · Mar 10, 2013

On the following page

http://www.bouthors.fr/wiki/doku.php?id=en:linux:synchro_lftp

the authors state:

When uploading, it is not possible to set the date/time on the files uploaded, that's why –>ignore-time is needed.

so if you use the flag combination --only-newer and --ignore-time you can achieve decent backup properties, in such a way that all files that differ in size are replaced. Of course it doesn't help if you really need to rely on time-synchronization but if it is just to perform a regular backup of data, it'll do the job.