Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!sun-barr!newstop!sun!warp!rock From: rock%warp@Sun.COM (Bill Petro) Newsgroups: comp.unix.questions Subject: Re: Need a file killer... Message-ID: <122792@sun.Eng.Sun.COM> Date: 21 Aug 89 17:53:11 GMT References: <2167@netcom.UUCP> Sender: news@sun.Eng.Sun.COM Reply-To: rock@sun.UUCP (Bill Petro) Distribution: na Organization: Sun Microsystems Lines: 59 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