[comp.mail.mh] Mail purger

ziegast@ENG.UMD.EDU (Eric Ziegast) (01/18/91)

I just thought I'd post a neat little alias I have since I have some time
to kill and nothing to do.

	alias purge 'find ~/Mail -name #\* -print | xargs /bin/rm'

Some people out there may be wondering why thier mail directories are
taking up so much space even though they may be reletively empty.
When rmm is used, MH adds a hash mark (#) to the beginning of the
filename of the message.  The message is not deleted.  This is good
because it serves as a backup feature, but it is also bad if you're
short of disk space and want to free some by removing Mail messages.

What this alias does is recursively go down through your mail directory
and find all files that start with a hash mark.  It then feeds this
list as arguments to rm.
________________________________________________________________________
Eric W. Ziegast, University of Merryland, Engineering Computing Services
ziegast@eng.umd.edu - Eric@[301.405.3689]

peter@ria.ccs.uwo.ca (Peter Marshall) (01/18/91)

In article <9101171719.AA07907@coke.eng.umd.edu>, ziegast@ENG.UMD.EDU
(Eric Ziegast) writes:
|> 
|> Some people out there may be wondering why thier mail directories
are
|> taking up so much space even though they may be reletively empty.
|> When rmm is used, MH adds a hash mark (#) to the beginning of the
|> filename of the message.  The message is not deleted.  This is good
|> because it serves as a backup feature, but it is also bad if you're
|> short of disk space and want to free some by removing Mail messages.

If you put the line 
	rmmproc: rm
into you .mh_profile, then "rm" will be used to delete things and the
hash (#*) files will not appear.  You loose the backup, but you don't
have to remember to clean up either.

For some reason the Draft-Folder directory still gets cluttered up with
files that begin with a comma ",".  (Not to mention all those emacs
files ending with "~" that get left around....)

--
Peter Marshall, Manager (Academic Networking)
CCS, NSC, U. of Western Ontario, London, Canada N6A 5B7
(519)661-2111x6032
peter.marshall@uwo.ca pm@uwovax (BITNET); peter@ria.uucp

jromine@buckaroo.ics.uci.edu (John Romine) (01/18/91)

ziegast@ENG.UMD.EDU (Eric Ziegast) writes:
>I just thought I'd post a neat little alias...
>
>	alias purge 'find ~/Mail -name #\* -print | xargs /bin/rm'
>
>When rmm is used, MH adds a hash mark (#) to the beginning of the
>filename of the message.  The message is not deleted.  This is good
>because it serves as a backup feature, but it is also bad if you're
>short of disk space and want to free some by removing Mail messages.

On our system, these files get deleted after a few days via a cron
entry.  We run finds over all the partitions where users files are
stored, and remove old "backup" and core files.

If your system doesn't do this, let me second Eric's suggestion and
recommend that you also put a find command like that above, in your
.logout file.
--
John Romine

wiseb@turing.cs.rpi.edu (G. Bowden Wise) (01/18/91)

When I started using MH, I discovered just how much my disk space
can grow after a week of messages piling up.  So, what I do now is
invoke a weekly 'cleanfiles' job using the 'at' (unix) command.  

This job deletes all my deleted mail messages in all my folders, deletes
all emacs backup files, as well as autosave files that may have been
left aroound.  The 'find' command is used to do this.

This gives me the flexibility of not having to delete things right
away as well as some peace of mind that my disk usage is being kept 
under control.
--
--------------------------------------------------------------------
- Bowden Wise
  Computer Science Dept, Rensselaer Polytechnic Inst, Troy, NY 12180
  internet: wiseb@turing.cs.rpi.edu      bitnet: bowden@rpitsmts

khera@thneed.cs.duke.edu (Vick Khera) (01/18/91)

here's a nice clean way i remove old file from my mh directory that
are a couple of days old.  in my .logout file:

# if this is the machine that i read mail on (as set by .login) then
# go through the mh directory and clean up all old ``deleted'' messages.
if ( $?mail ) then
  find `mhpath +` \( -name ,\* -mtime +2 -o -name \*~ -o -name annotate\* \) \
    -print | xargs rm -f &
endif

--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Vick Khera, Gradual Student/Systems Guy   Department of Computer Science
ARPA:   khera@cs.duke.edu                 Duke University
UUCP:   ...!mcnc!duke!khera               Durham, NC 27706     (919) 660-6528