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.
|
1 answer
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% |
--checkpointwhich 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 helpfind . -type f | wc -lfind . -type f | wc -lfind . -type f | wc -l. - KoVadim