Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 beta 3/9/83; site desint.UUCP Path: utzoo!watmath!clyde!bonnie!akgua!whuxlm!harpo!decvax!ittvax!dcdwest!sdcsvax!sdcrdcf!trwrb!desint!geoff From: geoff@desint.UUCP (Geoff Kuenning) Newsgroups: net.sources Subject: Shell script to list what's NOT in the history file Message-ID: <223@desint.UUCP> Date: Sun, 18-Nov-84 12:56:00 EST Article-I.D.: desint.223 Posted: Sun Nov 18 12:56:00 1984 Date-Received: Tue, 20-Nov-84 03:16:47 EST Reply-To: geoff@desint.UUCP (Geoff Kuenning) Organization: his home computer, Manhattan Beach, CA Lines: 53 The following script locates all files in the usenet spool directory that are not listed in the history file. Since "expire" runs off of the history file, these are files that will never be removed from the spooling directories. Cut at the line below, and don't forget to also remove my signature at the end! ------------------------CUT HERE----------------------------- #!/bin/sh # # %W% %G% %U% # # Compare the usenet history file with the actual contents of the # spool directories, and report any discrepancies. # # Usage: # # histmiss libdir spooldir [extra find options] # # If no find options are given, all plain files in the spool directories # are reported, even if they do not have an all-numeric name. # # Examples: # # To remove anything that is not in the history file: # # histmiss /usr/{lib,spool}/news | xargs rm -f # # To remove anything that is both not in the history file, and is more # than two weeks old (this could be run on a daily basis as a backup # form of expire): # # histmiss /usr/{lib,spool}/news -mtime +14 | xargs rm -f # LIBDIR=$1 SPOOLDIR=$2 shift; shift TEMP=/tmp/hm$$ PATH=/bin:/usr/bin export PATH trap "rm -f $TEMP; exit 1" 1 2 15 cut '-d ' -f3- $LIBDIR/history | tr . / | tr -s ' ' \\012 | sort -u > $TEMP cd $SPOOLDIR find . -type f $* -print | sed 's/^\.\///' | sort -u | comm -23 - $TEMP rm -f $TEMP exit 0 ------------------------CUT HERE----------------------------- -- Geoff Kuenning First Systems Corporation ...!ihnp4!trwrb!desint!geoff