* Chris G <c...@isbd.net> [2009-09-25 17:15 +0100]: > On Fri, Sep 25, 2009 at 04:35:46PM +0100, Arthur Dent wrote: [...] > > > > I use Archivemail (http://archivemail.sourceforge.net/) > > > > to do exactly what you describe. [...] > > Now as it happens none of those top level directories go down > > beyond 1 level, but each of them does have several > > sub-directories, each of which gets > > archived as expected. > > > I guess it's archiving all the folders/mailboxes that are addressed by > ~/Mail/MLists/* and similar. I suppose I could do something like that > because my hierarchy isn't all *that* deep. I could even use things > like ~/Mail/*/* though I'm not sure if that wouldn't catch too much in > some cases.
If all of your folders are mbox and therefore files, it wouldn't be difficult to do with some scripting. #! /bin/sh archivedir=~/Mail-archive date=$(date '+%Y-%m-%d') cd ~/Mail && find . -type f -exec sh -c ' subdir=${1%/*} mbox=${1##*/} if [ "$subdir" = "." ] then outputdir=$archivedir else outputdir=$archivedir/${subdir#./} fi archivemail --no-compress --date="$date" \ --output-dir="$outputdir" --archive-name="$mbox" "$mbox" ' sh {} \;