Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am using lftp for mirroring the files on a server to a PC. The problem for me is that as I put a batch of files on the PC that are exactly the same as the ones on the server, the mirroring starts of all files. Probably due to differing time stamps? That is a problem since the mirroring is only intended to change some files I may change, not all (a massive number of files).

What I want is that lftp: 1. Updates the PC with new files that are put on the server 2. Deletes any file on the PC that is no longer on the server 3. (and here the problem comes) Files that exist on the PC and the server, should only be updated on the PC if there is a difference in file size (ignoring any potential time stamp difference) This is how the command looks like right now:

LCD="/home/administrator/files"
RCD=""
lftp -c "ser ftp:list-options -a;
open ftp://$username:$pw@$host;
lcd $LCD;
cd $RCD;
mirror --delete"

what should i add/change? Thanks in advance. /Toby

share|improve this question

migrated from stackoverflow.com Sep 15 '11 at 6:04

This question came from our site for professional and enthusiast programmers.

    
I was reading an outdated manual, now I found the option: --ignore-time I tested it and it was exactly what I wanted. –  Toby Sep 14 '11 at 12:40
1  
Then you should answer your own question and accept your answer so that the circle is closed (you might need to wait some time till you can do that though) –  dario_ramos Sep 14 '11 at 12:45
1  
While I'm glad your problem is solved, tools such as rsync(1) or git(1) can do this job far better than lftp(1) -- not every update to a file will change the file size, and your lftp(1) process will miss those. And when files are updated, many types are modified in a way that rsync(1) or git(1) can modify in place, rather than transfer completely from scratch. –  sarnold Sep 15 '11 at 1:35

1 Answer 1

I was reading an outdated manual, now I found the option: --ignore-time I tested it and it was exactly what I wanted.

share|improve this answer
    
sarnold, I could not use rsync or git since there was some requirements they did not support (I think it was that I had to log in to an ftp account, but it could also been something else) –  Toby Sep 15 '11 at 9:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.