2

I am trying to mirror directories with lftp but I don't want to download filetypes that are notoriously large like .mp4 and .swf. But I am having trouble with the regex - and seeming like the exclude-glob too. Both of them download all files.

What I tried:

/usr/local/bin/lftp -u user,pass -e 'mirror -x ^(\.mp4|\.swf)$ $src $dest' ftp.host

&&

/usr/local/bin/lftp -u user,pass -e 'mirror -X swf $src $dest' ftp.host

1 Answer 1

0

In the first case you have to quote the vertical bar (|), since inside lftp it is a special symbol too (also use double quotes to interpolate src and dest variables, quote backslash and dollar sign to prevent their interpretation by the shell):

/usr/local/bin/lftp -u user,pass -e "mirror -x '^(\\.mp4|\\.swf)\$' $src $dest" ftp.host

In the second case you have to use glob patterns, like this:

/usr/local/bin/lftp -u user,pass -e "mirror -X *.mp4 -X *.swf $src $dest" ftp.host

In any case I would recommend to test the mirror command by hand first and automate it later.

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.