I have managed to generate a file list of paths to the files I need to compress. Now I need to step though each path and filename, and compress the file.
The 2nd loop does not work yet, so its just an analogy of what I am trying to do.
Code:
for path in `find /var/log/hosts/*/2008/11/* -type f`; do
echo $path >> ./tmp/path.tmp
done
# Extract directory path
cut -d"/" -f1,2,3,4,5,6,7,8 ./tmp/path.tmp >> ./tmp/path1.tmp
# Extract filename
cut -d"/" -f9 ./tmp/path.tmp >> ./tmp/file.tmp
# Put into Loop for each path and file name
for path1 in ./tmp/path1.tmp; do
# Change into directory
cd $path1
# Tar file and gzip
tar cf - $file | gzip -c > $file.tgz
# Change back to working directory
cd /home/hanzo/bin/
done
thanks