0

I have read this question and its answer, but they do not answer my question.

The shell script is this:

let total=$(lftp -f lftp-script-count.txt | wc -l)-2

lftp -f lftp-script.txt |

while read word word2 filename
do
    if [ "$word" = Transferring ]
    then let count=count+1
         let percent=count*100/total
         echo -e "XXX\n$percent\nDownloading $filename\nXXX"
    fi
done |

whiptail --title lftp --gauge progress 10 60 0

The lftp-scrip-count.txt lftp script works well:

debug 10
set ssl:verify-certificate no
open ...
user ... ...
cd ...
ls -R .

The lftp-scrip-count.txt lftp script works slow (but works for sure although I would love it to work faster) and the progress does not get to whiptail:

set ssl:verify-certificate no
open ...
user ...
cd ...
mirror -P=10 . lftp-works --exclude-glob=node_modules
quit

The result is that the progress bar is shown but remains at 0% till the end although it got to download the entire 251MB. If I resize the terminal window the whiptail screen does not get repainted.

When it reaches the end of the download, the progress bar window disappears well.

It seems to me that the procent shown by the simple lftp -f lftp-script.txt is not global. The output of this command contains, besides the percent, things like this:

  • Waiting for response...
  • Receiving data/TLS
  • Making data connection...
  • Receiving data...

Example:

screenshot

My question is: How can I get the progress bar to show the progress well?

Is there another CLI FTP client that shows the progress and is good for my requirements as seen in the lftp scripts shown above?

Thank you.

Update 1

There are 2 remaining issues:

  1. It would be great if I could show the progress of the operation relative to the total number of files that will be copied, not all the files available to be copied, because I use --only-newer.
  2. Keeping (1) in mind, it would be interesting to find out why with --only-newer it has the same speed like without it, when the directory is already completely downloaded. If I could make the process faster it would be great.
  • 1
    You're missing the | at the end of the lftp command: lftp "ftp://$ftpuser:$ftppass@$ftphost" -e "$ftpsettings ; mirror -v -e $remotemedia $localmedia ; quit" |, which connects it to the while loop. – muru Mar 23 at 6:32
  • Thank you. I corrected it. Now it is like on my computer. – silviubogan Mar 23 at 6:36
  • 1
    Your mirror command uses different options (-v is missing, at least). Have you tried using the same options as in the linked post? – muru Mar 23 at 7:14
  • Thank you. With -v everything works well, except the speed... With FileZilla it worked faster when selecting to overwrite files only if they are newer. What could be the cause? I started using --only-newer but it still is slower with 1-2 minutes in plus when compared to FileZilla. – silviubogan Mar 23 at 13:42

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.