#!/bin/sh
cd $BASEDIR/subdirA
FILES=$(find . -type f -name "*.txt.*")
if [[ -z "${FILES}" ]]; then
tar -cvf /archive/Files_From_subdirA_archive_$(date +'%m%d%Y').tgz ${FILES}
rm ${FILES} #...to remove what you archived...
else
echo " no files to tar"
fi
### tar files from subdir B
cd $BASEDIR/subdirB
FILES=$(find . -type f -name "*.txt.*")
if [[ -z "${FILES}" ]]; then
tar -cvf /archive/Files_From_subdirB_archive_$(date +'%m%d%Y').tgz ${FILES}
rm ${FILES} #...to remove what you archived...
else
echo " no files to tar"
fi
so on..
|