Need a file killer...

Bill Petro rock%warp at Sun.COM
Tue Aug 22 03:53:11 AEST 1989


In article <2167 at netcom.UUCP> onymouse at netcom.UUCP (John DeBert) writes:
>(This is being posted for a friend who is sysadmin for a system running
> UniSoft's 68000 version 7 and who has no net access.)
>
>I need a script that will delete files throughout the system using a file
>containing the names of files to be deleted.
>
>Several application programs create temporary files for their use but fail
>to delete them and it's eating up too much space. THe filenames have little
>or nothing in common so using metacharacters is not practical. 
>
>Currently, I have to go through each directory and delete each file singly,
>which takes too much of my time. I would rather run something under cron
>that would take care of this.
>
>If anyone has a script that would do this, a copy would be most appreciated,
>
>Thanx in advance...
>
>---
>JJD
>onymouse at netcom.UUCP    ...!apple!netcom!onymouse


Here is something that I use:
(I also have a script that is run interactively that will sort by size,
age, patterns, etc - and allow the user to list, print, delete the
files.  If you're interested, I'll mail or post it.)


#!/bin/csh -f
# cleandisk - script that displays name and size of extraneous files while it
#             removes them
# Bill Petro - 8/89

# This script removes extraneous files including: "bak" files (*.bak, *.BAK), 
# "dot" bak files (.??*.bak), emacs work files (#*), object files (*.o),
# core dumps (core), shar files (*.shar), textedit temporary files (*#),
# personal temporary files (buf*),
# as well as files older than 22/90 days in various backup and 
# pending directories (~/nukem, ~/bak).

nice find ~ '(' -name cpre -o -name \
	'.??*.bak' -o -name \
	'*.bak' -o -name \
	'*.BAK' -o -name \
	'*.CKP' -o -name \
	'*.shar' -o -name \
	'buf*' -o -name \
	'#*'  -o -name \
	'*%' -o -name \
	'*.o' -o -name \
	core ')' \
     -user $USER -type f -exec ls -s {} \; -exec \rm '{}' \;
nice find ~/nukem -atime +22 -mtime +21 -user $USER -type f -exec ls -s {} \; -exec \rm '{}' \;
nice find ~/bak -atime +90 -mtime +90 -user $USER -type f -exec ls -s {} \; -exec \rm '{}' \;


{decwrl,hplabs,ucbvax}!sun!Eng!rock  Bill Petro



More information about the Comp.unix.questions mailing list