Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to preserve file modification time with LFTP

Tags:

ftp

I wrote a script that sync several servers at once. One of my problem is that I cannot get LFTP to preserve initial file modification time. So basically, it always upload all the files while only some changed.

Do you know how to force LFTP to preserve file modification time when downloading or uploading?

Thanks for any help.

Korchkidu

like image 289
Korchkidu Avatar asked Oct 08 '10 15:10

Korchkidu


People also ask

How does the lftp work?

lftp is a file transfer program that allows sophisticated ftp, http and other connections to other hosts. If site is specified then lftp will connect to that site otherwise a connection has to be established with the open command.

How use lftp command line?

Using lftp You can launch lftp by typing just lftp and then using an open command to take you to your target site or you can provide the target's name on the same line as lftp like I did. If you want to download an entire directory, you can use the mirror command.

What protocol does lftp use?

lftp can transfer files via FTP, FTPS, HTTP, HTTPS, FISH, SFTP, BitTorrent, and FTP over HTTP proxy. It also supports the File eXchange Protocol (FXP), which allows the client to transfer files from one remote FTP server to another.

What is lftp mirror?

The Linux lftp command is a sophisticated FTP/HTTP client that is also capable of being able to mirror the entire contents of a remote website to your local server, or vice-versa. Using the lftp command on your server can help save you time when copying website files from a remote server.


1 Answers

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.

like image 78
p6majo Avatar answered Oct 02 '22 08:10

p6majo