9

I usually edit my website locally and push it with this command:

lftp -u user,password host -e "mirror -c -e -R -x ^\.git/$ my /my; exit"

But now, my website dynamically appends data to the /my/data file.

I don't have this /my/data file locally.

QUESTION: How to push without deleting /my/data and its content?

Notes:

  • I could download /my/data and then run the command above, but data added in the few seconds before the download and the upload would get lost.
  • For the other files/folders, local deletion should be mirrored by a remote deletion.
  • I don't want to use --only-newer-like operations because clocks might not be adjusted.

2 Answers 2

4

Answer given by LFTP's maintainer:

Just exclude the folder using -x ^data/ option.

If you need to upload some local files into that folder, use two mirrors, one without -e option just for my/data folder.

3
  • How do I skip multiple files and directories? Commented Sep 5, 2021 at 12:10
  • 1
    @Ikechukwu: I have not tried, but maybe multiple -x arguments? Commented Sep 8, 2021 at 13:49
  • I confirm that you can use multiples -x (--exclude) and/or multiples -X (--exclude-glob). Commented Jan 24, 2023 at 16:50
0

"Just exclude the folder using -x ^data/ option."

Can i ask dumb question about the '^' caracter? what did it does? I just figure out that without it mirror still ignore the named folder in both sides (host and remote) I 1st thought that it means "ignore data folder in the remote side (only)"

3
  • If you have a new question, please ask it by clicking the Ask Question button. Include a link to this question if it helps provide context. - From Review Commented May 12, 2023 at 7:50
  • 1
    Probably en.wikipedia.org/wiki/… Commented May 15, 2023 at 4:46
  • -x takes an "extended regular expression, just like in egrep" as its argument according to lftp.yar.ru/lftp-man.html, so @nicolas is right: it means the start of the path. Otherwise data/ would match anywhere Commented Jan 27, 2024 at 22:11

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.