Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tlug] Excluding File type in Shell Find



I have a shell script that I am using for incremental backups that  finds
files 3 days old (or whatever), prints a list to a file, and makes a tar
file based on that list. The script works fine, but I have been trying to
add the condition of excluding other tar.gz files, without success.

I've been messing around with this for a couple of days now without success,
basically trying to put something together from various Shell tutorials that
I googled up, but I am apparently missing something basic.

The functional script looks like this:

find /home/chuck/docs -mtime -3 \! -type d -print > /home/chuck/docs/temp/filelist-incr.txt
tar -c -v -z -P -T  /home/chuck/docs/temp/filelist-incr.txt -f
/home/chuck/docs/increment-`date +%Y%m%d`.tar.gz

I tried modifying it like this:

find /home/chuck/docs -mtime -3 \! -type d \! -type f -name ".gz"  -print > /home/chuck/docs/temp/filelist-incr.txt
tar -c -v -z -P -T  /home/chuck/docs/temp/filelist-incr.txt -f
/home/chuck/docs/increment-`date +%Y%m%d`.tar.gz

And this:

find /home/chuck/docs -mtime -3 \! -type d -type f -name ".gz" -print > /home/chuck/docs/temp/filelist-incr.txt tar -c -v -z -P -T  /home/chuck/docs/temp/filelist-incr.txt -f
/home/chuck/docs/increment-`date +%Y%m%d`.tar.gz

But both seem to be wrong. Can anyone spot the error here?

Thanks

Chuck

---------------------------
Charles Muller  <acmuller@example.com>
Faculty of Humanities,  Toyo Gakuen University
Digital Dictionary of Buddhism and CJKV-English Dictionary [http://www.acmuller.net]
H-Buddhism List Editor [http://www2.h-net.msu.edu/~buddhism/]
Mobile Phone: 090-9310-1787


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links