[TynesideLUG] irb-tar-dated
Ian Bruntlett
ian.bruntlett at gmail.com
Mon Aug 23 19:57:50 UTC 2021
Hi,
Whilst thinking up irb-tar-progress, I wanted something that included the
datestamp in the name of a tar file to create. So I came up with
irb-tar-dated, a wrapper for irb-tar-progress which, in turn, is a wrapper
for tar. Note: it assumes irb-tar-progress is on the $PATH...
#!/usr/bin/env bash
# 2021-08-23 (c) Ian Bruntlett
#
# Name : irb-tar-dated
# Purpose : To create a tar file, with part of the filename being today's
date
# Note : This script generates the filename and delegates creation of the
# tar file to irb-tar-progress
function Usage
{
cat <<END-OF-USAGE-MESSAGE
Usage: $0 tar-file-name-stub names-of-files-or-dirs
Basically a convenient way to create a tar file whilst displaying progress
and, afterwards, summarise system resource usage.
Note the destination filename is created using the first parameter of the
script
and information from the date command
Example:
irb-tar-dated RPG-TSR RPG-TSR
END-OF-USAGE-MESSAGE
}
if [ $# -lt 2 ]; then
Usage >&2
exit 1
fi
echo $0 Running in $PWD
# DESTINATION_FILENAME=$1`date "+_%d_%B_%Y.tar.gz"`
DESTINATION_FILENAME=$1`date "+_%Y_%m_%d.tar.gz"`
shift
echo Now running irb-tar-progress $DESTINATION_FILENAME "$@"
irb-tar-progress $DESTINATION_FILENAME "$@"
--
-- 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