Great, have been hacking in bash for years for this behaviour, will be much better now !

exc_dirs=$(cat exclude_dirs | while read line; do if [ -n "$line" ]; then echo -n $line; echo -n "|"; fi; done)
if [ "$exc_dirs" != "" ]
then
        #bash subsitution of last pipe |
        exc_dirs=${exc_dirs%%|}
        echo set mirror:exclude-regex \"^\($exc_dirs\)\" >> $HOME/.lftp/rc
fi
lftp -f ...

Thanks!

Franck

Le 11/03/2016 08:55, Alexander V. Lukyanov a écrit :
Ok, I have added new mirror options. Please see 
https://github.com/lavv17/lftp/commit/391b5b9ee0c9f5c58cfad0951f3f6b1e15a12cc2

On Thu, Mar 10, 2016 at 05:36:59PM +0000, Alexander Lukyanov wrote:
Is it better to list file patterns in the file or plain file paths?

вт, 1 марта 2016, 7:56 Steven Dennis <nzdreame...@gmail.com>:

Hello,

I want to create a list of all the files that lftp has d/l to my local
computer and then use that list to have the next run exclude them from
being d/l again.  I cannot find anything specific in the man page that
allows you to use a file with stuff to exclude.

I did come across this post

https://multimerch.com/blog/rsync-lftp-and-exclude-lists/

"I searched for an ftp alternative to rsync and stumbled upon lftp in this
post. It looked really nice until I found out lftp doesn't support exclude
lists, which means you can't make it read exclude patterns from a file. The
good news is, lftp does allow you to specify multiple --exclude switches at
once, so I modified the command to make use of my exclude-list.txt like
this:


lftp -u username,password -e "mirror --only-newer sed 's/^/--exclude /'
exclude-list.txt | tr 'n' ' ' --reverse /path/to/local/dir
/path/to/public_html" server.com

This way, sed prepends every line with an --exclude switch and tr replaces
newlines so in the end we have our lftp mirror command with all necessary
excludes in it."

but am not sure if there is a more simple approach as this seems
complicated to a beginner in linux.

Please let me know if this is the best way to exclude files from d/l from
a file.

Thanks
_______________________________________________
lftp mailing list
lftp@uniyar.ac.ru
http://univ.uniyar.ac.ru/mailman/listinfo/lftp

_______________________________________________
lftp mailing list
lftp@uniyar.ac.ru
http://univ.uniyar.ac.ru/mailman/listinfo/lftp
_______________________________________________
lftp mailing list
lftp@uniyar.ac.ru
http://univ.uniyar.ac.ru/mailman/listinfo/lftp

_______________________________________________
lftp mailing list
lftp@uniyar.ac.ru
http://univ.uniyar.ac.ru/mailman/listinfo/lftp

Reply via email to