Discussion:
exclude folders with regex possible?
marco
2013-04-11 18:27:05 UTC
Permalink
I am adding this to the mirror option.
--exclude-glob distri/sites/.*/files/styles/

My plan is to exclude the styles directory fully. The problem is that it is
insubfolders of

distri/sites/foo/styles
distri/sites/foo1/styles
distri/sites/foo2/styles
distri/sites/foobar/styles
...

with the exclude option i posted above lftp will still download folders
like:
distri/sites/foobar/files/styles/square_thumbnail/public/rattan_ernte2.jpg

thankys for helping me.

I actually writing on a small script that mirrors an ftp to localhost:

lftp -e "
set ftp:list-options -a;
set ftp:charset ISO-8859-15;
set ssl:check-hostname no;
set net:timeout 60;
set net:max-retries 2;
set net:reconnect-interval-base 5;
open ftp://$user:$pass@$host;
lcd $local_dir;
cd $remote_dir;
mirror --use-cache \
--parallel=3 \
--continue \
--delete \
--verbose=1 \
--exclude-glob screensnapr/ \
--exclude-glob usage/ \
--exclude-glob logs/ \
--exclude-glob cgi-bin/ \
--exclude-glob INCOMING/ \
--exclude-glob distri/sites/.*/files/styles/ \
--exclude-glob amazon/
quit" | tee log.txt
Alexander V. Lukyanov
2013-04-15 09:54:14 UTC
Permalink
Post by marco
I am adding this to the mirror option.
--exclude-glob distri/sites/.*/files/styles/
You have to use glob syntax:

--exclude-glob distri/sites/*/files/styles/

or regex syntax:

--exclude ^distri/sites/.*/files/styles/

Glob wildcard * will only match a single path component, regex .* will
match any substring in the path.
--
Alexander.
Alexander V. Lukyanov
2013-04-17 09:25:10 UTC
Permalink
then i tried this, with the aim to only exclude foo/modules and NOT
foo/bar/modules
--exclude ^[a-z]*/modules/ \
this is a valid regex in my testing tool but this will cause an error
mirror: Access failed: 550 / : No such file or directory
Unknown command `--exclude-glob'.
This is caused by an extra space after backslash. The backslash must be the
last character on the line to glue two lines together.

--
Alexander.

Loading...