2

I'm using lftp to push content to an ftp-only web-server. It worked to upload the files recursively at first, and even incrementally.

Any idea why this would skip files changed in a subfolder, but not skip files changed in the home directory?

Details: I'm using the reverse mirror mode, which pushes local data up to the server instead of downloading it from the server. Throughout the web, this is the recommended option for recursive upgrade.

Here's the full script (from this answer)

#!/bin/bash    
HOST="..."
USER="..."
PASS="..."
FTPURL="ftp://$USER:$PASS@$HOST"
LCD="/local/directory"
#RCD=""
#RCDCMD=cd $RCD;
#DELETE="--delete"
lftp -c "set ftp:ssl-allow no;
set ftp:list-options -a;
open '$FTPURL';
lcd $LCD;
$RCDCMD \
mirror --reverse \
   $DELETE \
   --verbose \
   --exclude-glob .*swp \
   --exclude-glob .*swn \
   --exclude-glob .*swo"

The related question, was solved by permission issues, which is not an issue in this case. Everything is "rwxr-xr-x" on the server.

Further Testing: The lftp seems to work intermittently. For example, I will run the command twice, and it skips the changes, then the third time it works, correctly copying the changed files up to the server.

Josiah Yoder
  • 141
  • 1
  • 6
  • does `ls -R` work on the remote server? – mc0e Dec 11 '15 at 16:13
  • I do not have SSH login on this server. Are you referring to an ftp command? – Josiah Yoder Dec 12 '15 at 22:01
  • Please do not downvote this question without providing feedback about what is wrong with it. I believe the question is well-researched, and likely a common problem for those who must use lftp instead of rsync because, like me, they don't have ssh access to a website. – Josiah Yoder Dec 12 '15 at 22:02
  • `ls -R` gets a mention in the lftp man page. I presume it's an lftp command. – mc0e Dec 13 '15 at 01:44
  • Yes, lftp's `ls -R` command works. On the other hand, files in recursive directories are also being correctly copied now too. Looks like I need to do some more testing on when the bug occurs and when it doesn't. – Josiah Yoder Dec 16 '15 at 22:32
  • Now reported as bug: http://linux.overshoot.tv/ticket/5380. (This is a private page) – Josiah Yoder Jan 11 '16 at 14:57

1 Answers1

0

Within the lftp command, run an ls -R before the mirror.

# Set variables as in the question
lftp -c "set ftp:ssl-allow no;
set ftp:list-options -a;
open '$FTPURL';
lcd $LCD;
ls -R;   # This is the key line!
$RCDCMD \
mirror --reverse \
   $DELETE \
   --verbose \
   --exclude-glob .*swp \
   --exclude-glob .*swn \
   --exclude-glob .*swo"

I'm going to continue testing, but this has worked every time I've tested it so far...

Josiah Yoder
  • 141
  • 1
  • 6