>Hi, I am trying to setup a cron that will tar all files within a certain >directory except one. I got it to tar all the files but can't figure out how >to exclude one of them. Here is the line that I was told would do it but it >includes whatever file I list as "somefile.txt". > >tar -cvf /home/httpd/hyperseek-dir.tar \ --exclude >/home/httpd/cgi-bin/search/data/hyperseek/somefile.txt \ >/home/httpd/cgi-bin/search/data/hyperseek/*
The —exclude option takes the name of a file that *contains* the list of files to exclude. So if somefile.txt is the file that you don't want archived, do:
echo /home/httpd/cgi-bin/search/data/hyperseek/somefile.txt > /tmp/exclude-file tar -cvf /home/httpd/hyperseek-dir.tar \ --exclude /tmp/exclude-file \ /home/httpd/cgi-bin/search/data/hyperseek/*
Barry Margolin
documented on: 1999.11.16 Tue 10:10:52