[TynesideLUG] irb-tar-progress

Ian Bruntlett ian.bruntlett at gmail.com
Mon Aug 23 19:54:50 UTC 2021


Hi,

Last night I was thinking about tar and how distracting it is to tell bash
and tar to provide progress information whilst creating a potentially big
tar file. So I created irb-tar-progress today - the irb- prefix is to make
sure I don't pollute the global namespace because it is in my ~/bin
directory...

Here it is...

#!/usr/bin/env bash
# 2021-08-23 (c) Ian Bruntlett
#
# Name    : irb-tar-progress
# Purpose : To create a tar file, with progress indicators

function Usage
{
cat <<END-OF-USAGE-MESSAGE
Usage: $0 tar-file-name.tar.gz names-of-files-or-dirs
Basically a convenient way to create a tar file whilst displaying progress
e.g.
irb-tar-progress RPG-TSR.tar.gz RPG-TSR
END-OF-USAGE-MESSAGE
}

if [ $# -lt 2 ]; then
    Usage >&2
    exit 1
fi

echo "$0" Running in "$PWD"
echo Creating tar file: $1
/usr/bin/time -f "%E mins:secs " tar --checkpoint=4000
--checkpoint-action=ttyout='%{%Y-%m-%d %H:%M:%S}t (%d sec): #%u, %T%*\r'
-czf  "$@"


-- 
-- ACCU - Professionalism in programming - http://www.accu.org
-- My writing - https://sites.google.com/site/ianbruntlett/
-- Free Software page -
https://sites.google.com/site/ianbruntlett/home/free-software


More information about the Tyneside mailing list