I have a statement that looks like this:

set cmd 'set ssl:verify-certificate false;
open -u abc,def ftp.somewhere.com;
mirror --only-newer --exclude-glob "{.git|node_modules|wp-config.php}" \
/public_html '"$argv"

and it is used in this statement:

lftp -c $cmd

The interesting thing is that "{.git|node_modules|wp-config.php}" does not stop the file wp-config.php from being put in the output dir.

Maybe I don't understand yet the syntax of fish well enough.

Update 1

This question is abandoned because I succeeded in the same task using rclone inside fish. rclone is very popular on GitHub.

rclone sync html $RCLONE_REMOTE:$PUBLIC_HTML_PATH -P --log-file=$fn2 \
  --filter "- wp-content/themes/$THEME_NAME/node_modules/**" \
  --filter "- wp-content/themes/$THEME_NAME/vendor/**" \
  --filter "- wp-config.php" \
  --filter "+ wp-content/themes/$THEME_NAME/react-nav-bar/dist/**" \
  --filter "- wp-content/themes/$THEME_NAME/react-nav-bar/**"
  • my lftp does not have an exclude-glob option for mirror. It does have exclude-regex. And that pattern is not strictly a glob pattern (in bash, brace expansions are separate from globbing), but this is how lftp implements it, not fish. Mar 22, 2021 at 13:18
  • @glennjackman I use lftp 4.9.2. What version of lftp do you have? Do you think that instead of --exclude-glob "{.git|node_modules|wp-config.php}" most probably I should use --exclude-glob "(.git|node_modules|wp-config.php)" (also notice the double quotes)? Thanks. Mar 22, 2021 at 19:54
  • 1
    Same version, I don't see --exclude-glob in the man page. Perhaps the man page is not exhaustive. Anyway, apparently lftp does not honour the brace expression as a glob pattern. Try mirror --exclude .git --exclude mode_modules --exclude wp-config.php Mar 22, 2021 at 20:36
  • I think that --exclude-glob is an option for the mirror command. At the start of the question I put the contents of a lftp script. Mar 23, 2021 at 0:51


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.