#! /bin/bash -f
# Last edited on 2007-03-18 09:05:55 by stolfilocal

# Usage "$0 {DIRECTORY}
# 
# Creates an archive called "{DIR}.tgz" of directory "{DIR}".
# Also lists the contents of the directory as "{DIR}.fsd".
# Also lists the contents of the tarfile as "{DIR}.dir".
# Checks for a file "{DIR}.txt" and complains if missing.

dir="$1"; shift;
if (( $# != 0 )); then
  echo "usage: ${usage}"  1>&2; exit 1
fi

echo "=== ${dir} ==="
tar -czf ${dir}.tgz ${dir}
ls -l ${dir}.tgz
tar -tvzf ${dir}.tgz | tar-tvf-to-sdf | sort -k3,3 > ${dir}.dir
find-all-files-size-date ${dir} > ${dir}.fsd

if [[ ! -r ${dir}.txt ]]; then
  echo "missing file ${dir}.txt"  1>&2
fi
