# Backup of old mail

## Il turisto

Hi,

I have a server mail (exim) with a big packet of mail (more than 100 gigas).

My request is simple in fact. I wanna know if someone have a script who take the mail older than a date, make an archive an delete it from the file system.

Of course the directory structure must rest the same because this older mail are sometimes useful.

Thanks for help.

----------

## Il turisto

no one can help me?

----------

## nevynxxx

Is it maildir or mbox?

If it's maildir, any backup too can be used as each mail is a sperate file, so the backup script can find them individually and move them.

I do some automatic filtering on the server side for my mail boxes like this.

If it's mbox you will probably need some special software I think.

Tried the exim users mailing list?

----------

## Il turisto

It's maildir.

I have a file per mail.

Can you show me your script?

----------

## Proteus

I don't know about a script for suc a task but my idea would be to setup an Imap server,

connect to it with a client and then download all the mails you want to backup and backup your

complete imap client.

But I am sure that a script-guru would do it much faster and better  :Smile:  Just an idea.

----------

## nevynxxx

 *Il turisto wrote:*   

> It's maildir.
> 
> I have a file per mail.
> 
> Can you show me your script?

 

not at the moment, my serevr is down  :Smile: 

try man find, if you're archiving old mail.

It can find all files created after a specific date, under a specific dir. find can also run a command on each file so something like

find <path to mail store> -mtime date -exec mv {} backup/mail/;

should do the trick, then tar that up and store it.....

----------

## adsmith

emerge archivemail, a beautiful python script which does everything you want and more.

----------

## Il turisto

@Proteus : it is an imap server  :Smile:  but I have a lot of mailboxes.

@nevyxxx : sorry for your server. I hope that this is not too important.

I have tried the command find but it lost the directory structure.

@adsmith : Great idea I wil try that and post my comment here. I think that this script is what I need. Does it delete backuped mail or I have to delete it myself? (Bad question I will try  :Wink:  )

----------

## Il turisto

Ok guys backup work correctly but now how can I restore mails?

The soft make a gz files. When I gunzip this file I have a big text file. and of course I can't use it with my mail server.

edit : this soft only archive cur directory. If the user have made some subdirectory they are not backuped. A solution?

----------

## adsmith

Well, you can run it on multiple directories -- a simple "find" script will do that for you.  

I run 

```

archivemail -d 90 -s '' -o ~/ARCHIVES/ ~/mail/* 

```

in my crontab, but you could easily do something like:

```

find ~/mail/* -type d | while read thisdir; do 

   archivemail -d 90 -s '' -o "~/ARCHIVES/$(basename thisdir)" "$thisdir" 

done

```

NOTE: I have not sanity checked this code on real data!

You can easily disable the gzipping if you don't want it.

However, a clever mail client like mutt will read gzipped mailboxes just fine.  Sadly, this doesn't work through IMAP, only locally.

----------

## Il turisto

thansk for the script I will try it.

But archivemail made one file with all mails into it and I have one file per mail in my filesystem.

So how can I restore mail?

----------

## adsmith

archivemail should give you one archive file per mailbox, which is the logical way to do it, I think.  

Do you really want one archive file per message, or are you saying that it somehow gave you one archive file for *all* mailboxes?

As I said, I haven't used it on maildir's, but in any case, the default output format of archivemail is a gzipped mbox.  So, gunzip it to a flat mbox file, then use any mbox->maildir converter to restore all the mail.

----------

## Il turisto

Yes it gave me one archive per mailbox and this is perfect.

But in this archive it put all the mails in one big text file. And I have mailbox type so I have a file per mail.

So when I deflatte the archive I cannot use the big file for restore my mails.

----------

## adsmith

Right, so you just need any mbox -> maildir utility to convert that back to maildir.  These programs are all over the place if you check google, etc.

(This sort of problem is exactly why I prefer mbox to begin with.  It's just so darn simple, and you can fix any mailbox error with your favorite text editor.)

----------

## Il turisto

The problem is a little more complicated because if I have to restore mail it is one or two and not all.

Thanks for your reponse

----------

## adsmith

Well, one (craptastic) way to do this is to use a mail client which reads both mbox and maildir, then move the messages from the mbox mailbox to a maildir mailbox.

alternatively, just go back to writing a custom bash script in a cron job.....

----------

## BitJam

Il turisto,

I just wrote a Perl program that archives mail in maildirs to  maildirs under a new directory tree.  Here is the usage:

```
Usage:  archive-maildir [options] maildir [new_maildir]

Options:

        -d --dirs       Read directory list from STDIN

        -h --help       Print this help.

        -l --list       Just list the directories found.

        -m --mkdir      Make destination dirs even if empty.

        -n --newer DAYS Moves files newer than DAYS

        -o --older DAYS Moves files older than DAYS

        -p --pretend    Don't really move anything.

        -v --verbose    Print what we do as we do it.

You can specify both --older and --newer.

If a new_maildir is not specified, maildir.archive is used.
```

Here is a sample output (in pretend mode):

```
./archive-maildir  --pretend --older 800 Mail/

Move (25) files to Mail.archive/Misc/cur

Move (16) files to Mail.archive/.Misc.directory/EarthLink/cur

Move (19) files to Mail.archive/drafts/cur

Move (1143) files to Mail.archive/sent-mail/cur

Move (15) files to Mail.archive/.Friends.directory/Nia/cur

Move (33) files to Mail.archive/.Friends.directory/Emma/cur

Move (365) files to Mail.archive/.Friends.directory/Alvin/cur
```

It looks for cur, new, and tmp directories but by default only makes new directories as needed which is why tmp and new don't show up in the output.  It shells out to the find command for finding the directories and then finding the files within the directories which can make it a tad slow for small directories but I hope it will make it robust for larger problems such as yours.

The initial find (for all the cur, tmp and new) directories can be a bit slow if you want to play around in pretend mode.  That's why I added the --dirs and --list options.  They allow you to cache the list of directories in a file: 

```
 $ archive-maildir --list Mail/ > dirs.txt

$ cat dirs.txt | archive-maildir --dirs --pretend --older $ODAYS  Mail/
```

You can also put in greps after the cat to only deal with a subset of the directories at a wack.

I'll post the code if you are interested.

----------

## carpman

Hello, been trying to get this working but having 2 problems:

Working on multiple user mailboxs uses one command

using suggestion earlier in thread

```

archivemail -n -d360 -s '' -o /home/mail-bak ~/.maildir/*

archivemail: '/root/.maildir/.*': no such file or directory

```

Of course i have no .maildir in root so would need to excluded that

Any suggestion getting this to work?

----------

## adsmith

Are you sure "~/.maildir/*" is correct?  What about just "~/.maildir" or "~/.maildir/.*"?

In the Maildir standard, any sub-folders are named with leading dots, so * would not catch them.

E.g., under ~/.maildir you may have

.folder

.folder.subfolder

courierimapkeywords

archivemail only sees that one file with the glob you use, but this is a just a dumb cache file and not a mail folder.

----------

## carpman

Ok realised that i should have /.* so tried again with:

```

archivemail -n -d360 -s '' -o /home/mail-bak ~/.maildir/.*

```

Also tried after create dir /root/.maildir

```

archivemail -n -d360 -s '' -o /home/mail-bak ~/.maildir/.*

/root/.maildir/.: I would have archived 0 of 0 message(s) in 0.0 seconds

/root/.maildir/..: I would have archived 0 of 0 message(s) in 0.0 seconds

```

----------

## adsmith

uhh.. so what's actually there?

what's the output of 

"find ~/.maildir -maxdepth 1"

----------

## carpman

 *adsmith wrote:*   

> uhh.. so what's actually there?
> 
> what's the output of 
> 
> "find ~/.maildir -maxdepth 1"

 

Out put is:

```

find ~/.maildir -maxdepth 1

find: /root/.maildir: No such file or directory

```

It is just looking in dir of root all the time?

There are 3 users on system root and one user and one for sysadmin, root does not have .maildir and does not need one.

Both sysadmin and user do have .maildir though only user has mail old enough to need archiving at moment. If i run archivemail on the user only it works fine:

```

archivemail -n -d465 -s '' -o /home/mail-bak /home/sara/.maildir/.*

/home/sara/.maildir/.: I would have archived 178 of 865 message(s) in 2.7 seconds

/home/sara/.maildir/..: I would have archived 0 of 0 message(s) in 0.0 seconds

/home/sara/.maildir/.Clients: I would have archived 0 of 0 message(s) in 0.0 seconds

/home/sara/.maildir/.Drafts: I would have archived 43 of 143 message(s) in 0.3 seconds

/home/sara/.maildir/.Leads: I would have archived 0 of 0 message(s) in 0.0 seconds

/home/sara/.maildir/.Personal: I would have archived 30 of 205 message(s) in 0.6 seconds

/home/sara/.maildir/.Sales: I would have archived 0 of 0 message(s) in 0.0 seconds

/home/sara/.maildir/.Sent: I would have archived 768 of 2762 message(s) in 4.6 seconds

/home/sara/.maildir/.Pub: I would have archived 110 of 692 message(s) in 2.0 seconds

/home/sara/.maildir/.Support: I would have archived 0 of 0 message(s) in 0.0 seconds

/home/sara/.maildir/.Trash: I would have archived 0 of 1 message(s) in 0.0 seconds

/home/sara/.maildir/.VirusAlerts: I would have archived 0 of 0 message(s) in 0.0 seconds

/home/sara/.maildir/.spam: I would have archived 14 of 68 message(s) in 0.2 seconds

```

It just won't do this if try running on multiple user .maildir ?

.maildir is there for users:

```

 ls -la /home/sara_davis/

total 1275340

drwxr-xr-x  7 sara sara       4096 May 24 02:46 .

drwxr-xr-x  7 root       root             4096 May 26 14:35 ..

-rw-r--r--  1 sara sara        127 May 23 14:46 .bash_logout

-rw-r--r--  1 sara sara        193 May 23 14:46 .bash_profile

-rw-r--r--  1 sara sara        551 May 23 14:46 .bashrc

drwx------ 18 sara sara       4096 May 26 15:12 .maildir

```

----------

## adsmith

Yes, of course.  ~ expands to $HOME of the *current* user.  If you want to do this as a cron job, it must be the user's cron job (or you muck aroundwith sudo in your cron script).

----------

## carpman

 *adsmith wrote:*   

> Yes, of course.  ~ expands to $HOME of the *current* user.  If you want to do this as a cron job, it must be the user's cron job (or you muck aroundwith sudo in your cron script).

 

Ok but as i am system admin i need to run this on all users mail and want to do it with one cronjob not individual cron jobs for each user?

----------

## adsmith

OK, this is no longer an archivemail problem, but a combination of bash and cron.

First, you should go google for "Advanced bash scripting guide" for some pointers on scripting. 

some cobination of archivemail, chown, and maybe sudo will do what you want, I think. 

Although...  I'm not sure why you want root to cycle other user's mailboxes, since users generally want complete control of their own mailboxes.  The users could always run their own cron job...

----------

## carpman

 *adsmith wrote:*   

> OK, this is no longer an archivemail problem, but a combination of bash and cron.
> 
> First, you should go google for "Advanced bash scripting guide" for some pointers on scripting. 
> 
> some cobination of archivemail, chown, and maybe sudo will do what you want, I think. 
> ...

 

Ok but i am crap at scripting so that is going to be a pain?

Why do i want root to archive users mail? Because i am (newbie) sysadmin and users can't even put mail in folders let alone archive it, plus this a remote imap server so am not going to let them any where near things such cron. Also as a business all email must be kept for X amount of years so just getting them to delete it is not going work, which they have not done that for years and now some maildir are GB in size?

I currently use cron and home wild card to rub SA learn on multiple user home maildir so thought archive might do this?

```

*/30 * * * *    sa-learn --dir --spam /home/*/.maildir/.spam > /dev/null 2>&1

*/30 * * * *    sa-learn --dir --ham  /home/*/.maildir/ > /dev/null 2>&1

```

----------

## adsmith

No, it will be easy.

I would do something like a simple "do" loop running over the users homedirs  Here is pseudo-code bash outline-- do not try to run it or anything:

```

#!/bin/bash

## archive everyone's mail

find /home/ -maxdepth 1 -type d | while read USERDIR; do

  archivemail --(whatever) -o (whereever) ${USERDIR}/.maildir

  chown $(basename ${USERDIR})  [the output location] 

end do;

```

I think the chown might be necessary in case archivemail will make the archive owned by root.

----------

## carpman

 *adsmith wrote:*   

> No, it will be easy.
> 
> I would do something like a simple "do" loop running over the users homedirs  Here is pseudo-code bash outline-- do not try to run it or anything:
> 
> ```
> ...

 

Thanks for vote of confidence, still no wiser but if try i now have somewhere to start, besides i still have to get archivemail working, but that is another thread  :Smile: 

----------

## BitJam

Here is the code for my maildir archive program.  Use it at your own risk!

```
#!/usr/bin/perl

#

# archive-maildir -- A Perl program for archiving messages

#                    in a maildir format to another maildir.

use strict;

use Getopt::Long;

my $CHUNK_SIZE = 100;  #-- how many files to move in one go

my $FIND_DIRS = q(find '%s' -type d -and \\( -name cur -or -name new -or -name tmp \\) -print);

my $DIR_EXT = ".archive";

my $PRETEND;

my $VERBOSE;

my ($LIST_MODE, $NEWER, $OLDER, $DIRS, $MKDIRS, $COPY);

my $ME = $0; $ME =~ s{.*/}{};

my $USAGE = <<USAGE;

Usage:  $ME [options] maildir [new_maildir]

Options:

    -c --copy       Copy files instead of moving them.

    -d --dirs      Read directory list from STDIN

    -h --help       Print this help.

    -l --list       Just list the directories found.

    -m --mkdir      Make destination dirs even if empty.

    -n --newer DAYS Moves files newer than DAYS

    -o --older DAYS Moves files older than DAYS

    -p --pretend    Don't really move anything.

    -v --verbose    Print what we do as we do it.

You can specify both --older and --newer.

If a new_maildir is not specified, maildir$DIR_EXT is used.

USAGE

GetOptions(

    "copy"    => \$COPY,

    "dirs"    => \$DIRS,

    "help"    => sub { print $USAGE; exit},

    "pretend" => \$PRETEND,

    "verbose" => \$VERBOSE,

    "older=i" => \$OLDER,

    "newer=i" => \$NEWER,

    "list"    => \$LIST_MODE,

    "mkdir"   => \$MKDIRS,

) or die "\n$USAGE";

my $Move_Word   = $COPY ? "copy" : "move";

my $Move_Wordc  = ucfirst $Move_Word;

my $Move_Worded = $COPY ? "copied" : "moved";

#$OLDER or $NEWER or $LIST_MODE or

#   die "$ME: Cowardly refusing to archive mail without --older or --newer set\n";

@ARGV or die "$ME: Must specify a maildir directory.\n";

my $MAILDIR = shift;

$MAILDIR =~ s{/+$}{};                        #-- strip trailing /'s

my $NEW_DIR = shift || $MAILDIR . $DIR_EXT;

$NEW_DIR =~ s{/+$}{};

@ARGV and die "$ME: Extra command line arguments: @ARGV\n";

my @dirs;

if ($DIRS) {

    @dirs = <>;

}

else {

    my $find_dirs = sprintf $FIND_DIRS, $MAILDIR;

    #$VERBOSE and print "$find_dirs\n";

    @dirs = `$find_dirs`;

}

chomp @dirs;

$LIST_MODE and do {

    print map {"$_\n"} @dirs;

    exit;

};

my $file_cnt;

for my $dir (@dirs) {

    my $new_dir = $dir;

    $new_dir =~ s{^$MAILDIR/}{$NEW_DIR/} or do {

        warn "directory '$dir' does not start with '$MAILDIR'. Skipping.\n";

        next;

    };

    #print "$dir\n$new_dir\n\n";

    my $cmd = "find '$dir' -type f -and ";

    my @opts;

    $OLDER and push @opts, "-mtime +$OLDER";

    $NEWER and push @opts, "-not -mtime +$NEWER";

    @opts and $cmd .= join " ",  "\\(", join(" -and ", @opts), "\\)";

    $cmd .= " -print";

    #print "$cmd\n";

    my @files = `$cmd`;

    chomp(@files);

    @files or do {

        $MKDIRS and my_mkdir($new_dir);

        next;

    };

    $file_cnt += @files;

    my $s = @files == 1 ? "" : "s";

    print "$Move_Wordc (@{[scalar @files]}) file$s to $new_dir\n" if $PRETEND or $VERBOSE;

    move_files($new_dir, \@files);

}

print "($file_cnt) files to $Move_Word.\n" if $file_cnt and $PRETEND;

print "($file_cnt) files should have been $Move_Worded.\n" if $file_cnt and not $PRETEND;

#--- End of Main --------------------------------------------------------------

sub move_files {

    my ($dest, $files) = @_;

    my_mkdir($dest) or return;

    $PRETEND and return;

    while (@$files) {

        my @chunk = splice(@$files, 0, $CHUNK_SIZE);

        @chunk or last;

        my $cmd = $COPY ? "cp" : "mv";

        my @cmd = ("mv", qq{--target-directory=$dest});

        #print join(" ", @cmd, @chunk), "\n\n";

        #next;

        system(@cmd, @chunk);

    }

}

sub my_mkdir {

    my $dir = shift;

    return 1 if -d $dir;

    print "mkdir: $dir\n" if $VERBOSE;

    return 1 if $PRETEND;

    system("mkdir", "-p", $dir);

    -d $dir and return 1;

    warn "$ME: Warning, could not create directory '$dir'\n";

    return;

}

```

----------

## redwood

I though I might give this a try with my courier-imap maildir folders.

I have a lvm2 partition for backups "/mnt/mail/archives/"

and I created a backup folder for someuser:

# maildirmake -f Archives ~someuser/.maildir

Then moved the maildir folder:

# mv ~someuser/.maildir/.Archives /mnt/mail/archives/someuser

Then created a mount point, and mounted as bind:

# mkdir ~someuser/.Archives

# mount -t bind /mnt/mail/archives/someuser  ~someuser/.maildir/.Archives

When I make a backup with the script, 

archive-mail --list ~someuser/.maildir/ | grep -v Archives | \

bin/archive-mail -v --older 180 --pretend ~someuser/.maildir ~someuser/.maildir/.Archives

the script re-creates the dir structure of ~someuser/.maildir

e.g.

~someuser/.maildir/.Archives/{.INBOX, .FAX, ...}

which results in folders which aren't accessible with courier-imap.

Subfolders of the topdir .maildir must be created using periods instead of /

e.g.

~someuser/.maildir/{.Archives.INBOX, .Archives.FAX.From, .Archives.FAX.To}

I also tried creating a shared-folder

# maildirmake  /mnt/mail/shared    

   which creates /mnt/mail/shared/cur/,new/,tmp/ folders}

# maildirmake -S /mnt/mail/shared/archives/

   which creates /mnt/mail/shared/archives{cur/,new/.tmp/}

# maildirmake -s write -f someuser /mnt/mail/shared/archives

    which creates /mnt/mail/shared/archives/.someuser{cu/r,new/,tmp/,maildirfolder}

# su someuser -

# maildirmake --add Archives=/mnt/mail/shared/archives/ $HOME/.maildir

   which creates shared-maildir file containing name(s) of sharedfolders

   and    creates ~someuser/.maildir/shared-folders/archives/someuser{cur/,new/,tmp/,

   shared->/mnt/mail/shared/archives/.someuser, courierimapkeywords/, courierimapuiddb,shared-timestamp}

which results in similar folder-name hell.

Anyhow, the script does seem to work, ie. it finds all files older than some time, and copies them into

a new place, preserving the directory structure. But browsing the new maildir folder presents a problem if using

courier-imap. 

There is a CTAN module, MailFolder, for creating proper maildir folders/filenames, which might be the best way to go.

----------

## BitJam

 *Quote:*   

> Anyhow, the script does seem to work, ie. it finds all files older than some time, and copies them into a new place, preserving the directory structure. But browsing the new maildir folder presents a problem if using courier-imap. 

 

It was difficult for me to follow exactly what you want to do.  It appears that you want the archive-mail program to translate from one format to another which is not what it was designed to do.  Did the archive-mail program create your browsing problem or did the problem already exist with the folders you were started with?

----------

## redwood

Sorry for not being more clear.

I have a small office network. 

I run a courier-imap+postfix mail server (ala various Gentoo guides)

My users mostly use kmail (and occasionally squirrelmail) to access

their individual courier-imap accounts as well as a general office courier-imap account.

I also run a hylafax server which emails faxes to fax@mydomain which then get 

sorted by procmail into a FAX subfolder of the main office account.

The volume of faxes+emails is probably a couple hundred a week, which over time

becomes thousands of email messages. And since many of the emails contain attachments

such as scans of contracts, orders, etc., the ~office/.maildir folder has grown to gigabytes.

I can either buy more disk storage, and move ~office/.maildir to a bigger logical volume,

or ideally, automatically backup the folder to somewhere else, then delete the old emails.

But I want to be able to access the old emails/faxes if necessary. My regular backup is a 

complete rsnapshot (rsync hardlinks) backup to /mnt/backups/{daily.?, weekly.?}

But if I need to find a particular email message from 

/mnt/backups/weekly.4/www.mydomain.com/home/office/.maildir/.FAX/cur/

a file browser doesn't help because email messages with names like

1260889743.23851_0.www.mydomain.com:2,S

are meaningless without a mail program to display the From, To, Subject, etc

fields from the mail db.

Since my users use kmail with multiple imap accounts 

(eg. user1@mydomain, office@mydomain, spamtrap@mydomain)

I thought I might create an Archive folder under the office@mydomain imap account

and routinely backup  old emails to this folder, then delete the originals.

If I backup ~office/.maildir/.FAX to ~office/.maildir/.Archives

with your archive-mail script, it creates the folder

~office/.maildir/.Archives/.FAX into which it puts the emails,

but this folder is not visible with kmail because it is improperly named

for an imap subfolder.

The folder should instead be ~office/.maildir/.Archives.FAX

and similarly for other folders, eg.

~office/.maildir/.Archives.Contracts.2008

rather than ~office/.maildir/.Archives/.Contracts.2008

I suppose I could create an imap account archives@mydomain

and then backup ~office/.maildir to ~archives/.maildir

which would create correctly named folders.

I realize I could also use archivemail to backup my imap maildir folders to mbox files,

but then how to view the .mbox file? I think if I open a .mbox file with kmail, 

it automatically imports the mail back into my INBOX.

I suppose I haven't thought through this issue thoroughly yet,

which is why I was looking in the forums for ideas on archiving emails.

----------

## BitJam

Thanks for the crystal clear explanation.  I now understand what you want and why you want it.  Makes sense.  I will think about it.  In the meantime I think this is the easiest course of action:

 *Quote:*   

> I suppose I could create an imap account archives@mydomain
> 
> and then backup ~office/.maildir to ~archives/.maildir
> 
> which would create correctly named folders.

 

but there is no need to create a separate account.  KMail lets you select the top maildir folder so it might be easier to just change that instead of logging in as a different user.  I see why it would be more convenient for you to have working ~/.maildir/ARCHIVE directory.

----------

## redwood

I think you can only have one top imap folder "INBOX" with kmail, but maybe it can be renamed.

However, shared folders appear as top folders (not as subfolders of INBOX), which is why I

thought of using a shared archives folder.

Probably the simplest solution is to create an "archives" imap account,

then  use imapsync (in portage) to copy/move messages/folders to the archive account,

(ref: http://www.xexpress.org/2006/10/26/Archive%20mail%20with%20imapsync%20on%20Courier-IMAP/)

The Citadel (sunrise overlay) FAQ lists several other alternatives for transfering IMAP databases:

http://www.citadel.org/doku.php/faq:favoriteclient:migrating_mail_into_citadel#how.do.i.move.all.of.my.mail.from.a.legacy.mail.server.to.citadel

----------

## carpman

Having issues with out pf space message but is plenty of space on target backup partition?

It is archiving 5gb worth or email

```

archivemail -d400 -s '' -o /home/backup /home/user1/.maildir/.Archive_Sent/

archivemail: Warning - changing effective user id: this automatic feature is deprecated and will be removed from later versions.

Traceback (most recent call last):

  File "/usr/bin/archivemail", line 1602, in <module>

    main()

  File "/usr/bin/archivemail", line 702, in main

    archive(mailbox_path)

  File "/usr/bin/archivemail", line 1154, in archive

    _archive_dir(mailbox_name, final_archive_name, "maildir")

  File "/usr/bin/archivemail", line 1297, in _archive_dir

    archive.write(msg)

  File "/usr/bin/archivemail", line 383, in write

    self.mbox_file.write(body)

  File "/usr/lib/python2.6/gzip.py", line 197, in write

    self.fileobj.write( self.compress.compress(data) )

IOError: [Errno 28] No space left on device

Exception IOError: (28, 'No space left on device') in <bound method GzipFile.__del__ of <gzip on 0x9b892ac>> ignored

```

----------

## redwood

What does 'df -h /home/backup' report?

What does 'du -h /home/backup' report?

What format filesystem is /home/backup?

Are you perhaps running out of inodes?

----------

## carpman

 *redwood wrote:*   

> What does 'df -h /home/backup' report?
> 
> What does 'du -h /home/backup' report?
> 
> What format filesystem is /home/backup?
> ...

 

Out is

```

df -h /home/backup

Filesystem            Size  Used Avail Use% Mounted on

/dev/sda10            123G   76G   47G  62% /home

```

format is reiserfs

once backup is done then are moved to external drive.

----------

## redwood

Are 

/home/backup and  

/home/user1/.maildir/.Archive_Sent/

on the same partition?

The output of 'df -h /home/backup' says that backup is a folder in /home partition, right?

And you say that 'du -ch  /home/user1/.maildir/.Archive_Sent/' reports ~5G?

I don't know if archivemail uses /tmp, but you could check 'df -h /tmp'

----------

## carpman

 *redwood wrote:*   

> Are 
> 
> /home/backup and  
> 
> /home/user1/.maildir/.Archive_Sent/
> ...

 

yes they are on same partition but as i said after back the file are moved to external drive, don't do straight onto external as is slow usb drive.

I was wondering myself if it used /tmp and if it does this is going to be an issue as /tmp is is only 1.9gb

```

df -h /tmp

Filesystem            Size  Used Avail Use% Mounted on

/dev/sda3             1.9G   33M  1.9G   2% /tmp

```

I have one account that is going to require 10gb plus archive

----------

## redwood

I don't know python very well, 

but it looks like a temp_dir is created/used at line 1130 

of /usr/bin/archivemail 

and prints out what temp_dir is being used:

vprint("set tempfile directory to '%s'" % new_temp_dir)

----------

## carpman

 *redwood wrote:*   

> I don't know python very well, 
> 
> but it looks like a temp_dir is created/used at line 1130 
> 
> of /usr/bin/archivemail 
> ...

 

it does but no option or clue as to where this tmp dir is?

----------

## redwood

The logical place would be to create temporary files/directories in /tmp

The following describes python's temp_file module:

http://docs.python.org/library/tempfile.html

----------

## boerKrelis

I have not checked, but I hope all of us realize (and I'm sure that at least some of us do) that using 

```
find
```

 to find file by date spec does not fly very well on maildir. The file creation/modification date don't say much about the date the e-mail was received. Maybe the user moved some e-mail from 2007 inter-imap-account. Wham, according to find, the mail is now from 2010. Maybe the user changed the 'read' flag on the mail, causing the file's mtime to change.

You need tools that look into the maildir files for determining their arrival date. Archivemail is probably doing so ;-)

Most maildir implementations use a timestamp as the first part of the file, though, so you can still get creative using file utils if you insist, but those timestamps have no meaning to the message the MUA sees.

----------

