Repair invalid file dates on Maildir e-mail messages

Sometimes, some system administrators who we won't mention by name but may be the author of this FAQ will copy a message store from one server to another and forget to use the Archive flag to keep the file dates correct. This can cause issues with things like archiving old message from the command line.


The good news is, the person who made this mistake has written a script to fix the problem. A simple perl filter which opens a message, searches for the Date: tag, the resets the file date to that is attached. It is designed to be a CLI filter, ie it takes a file name on STDIN, then opens the file and searches for the origin date, then resets the datetime stamp on the file to that date. An example of how it might be used is:

find path_to_search -type f -exec /path_to_script/ \{\} \;


Your messages are stored in ~/user/Maildir/cur, and your script is in /root/bin/

find ~/user/Maildir/cur -type f -exec /root/bin/ \{\} \;


Attached files:

Last update:
2012-03-23 05:45
Average rating:0 (0 Votes)

You can comment this FAQ

Chuck Norris has counted to infinity. Twice.