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/**"
lftp
does not have anexclude-glob
option for mirror. It does haveexclude-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.lftp
4.9.2. What version oflftp
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.--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. Trymirror --exclude .git --exclude mode_modules --exclude wp-config.php
--exclude-glob
is an option for themirror
command. At the start of the question I put the contents of a lftp script.