[zenity] precise progress bar

Hello everyone,

Is it possible to have a precise progress bar in zenity during the execution of the following:

 find -type f \( -not -name "$file_name".md5 \) -exec md5sum '{}' \; > "$file_name".md5

Currently I am using

zenity --title="Running..." --progress --pulsate --auto-close --width=$WIDTH --height=$HEIGHT &

With my limited knowledge in bash scripting, I was thinking that maybe a way to have a progression bar would be the following:

1- I count recursively all the files in X dir.
2- I execute the command md5sum to create the .md5 file
3- At this point, I read the .md5 file every Y seconds to see the total files processed
4- I get the N of lines in the .md5 file and I do Total Files - Total Files Processed to get a progression...

Does it sound plausible?

Of course, if there is an alternative than using zenity, I am all hears.

Thank you in advance.

There are lots of complicated ways of making "better" guesses at how long it will take. Three is no way to get a "precise" value.

Note that it will take a lot longer to get the md5 sum of a 10Tb file than it will to get the md5 sum of a 10Kb file. Your algorithm assumes that all files are the same size. I see no reason to believe that that assumption is valid.

Your algorithm assumes that the load on your system will be constant during the time that your script is running. I see no reason to believe that that assumption is valid.

Etc., etc., etc...