Hello. Tell me, please, how can I display information about status as a percentage during archiving.
That is, how many percent is ready or the number of remaining files.
I have only one option: before starting the archiving, find out the size of the future archive and track its size.
But I do not know how to find out the size of the future archive.

  • one
    Run the second thread, which will calculate the progress. - perfect
  • @perfect, please tell us more about the second thread and how it should work. - Mr_Epic
  • 2
    Guaranteed to know the size of the future archive can only be one way - to archive and find out. But you can make a rough estimate, knowing how the different files are compressed. The text is good, but the video is almost there. In the case of tar there is an argument - --checkpoint which will output the number of processed files. and there is --checkpoint-action= - to perform the necessary action on each "checkpoint" Find out the number of files as a whole will help find . -type f | wc -l find . -type f | wc -l find . -type f | wc -l . - KoVadim

1 answer 1

For tracking both time and process performance using percentages for clarity, it is recommended to use the pv utility. You can install as follows apt-get install pv , for example:

 # tar -cvf archive.tar * | pv -s $(du -sb | grep -o '[0-9]*') > out.tgz 81B 0:00:00 [1.54MB/s] [> ] 0%