[comp.unix.questions] Need a file killer...

onymouse@netcom.UUCP (John DeBert) (08/21/89)

(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@netcom.UUCP    ...!apple!netcom!onymouse

rock%warp@Sun.COM (Bill Petro) (08/22/89)

In article <2167@netcom.UUCP> onymouse@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@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

onymouse@netcom.UUCP (John DeBert) (08/23/89)

Many thanks to all who replied to my inquiry for something to delete
files ("file killer"), even the two flames for not "RTFM," for
reminding me that I forgot to mention that "TINFM!" with the system for
their version of UNIX, at least, only their testing language.

I have passed them all on to my friend and he returns his thanks for
helping with the problem.

JJD
onymouse@netcom.UUCP