Giter Club home page Giter Club logo

dovecot-maildir-compress's Introduction

dovecot-maildir-compress

Compress and decompress mails in a maildir directory structure, for use with dovecot's zlib plugin

Why?

I needed a script for compressing mails on a mail server at the time of switching to using the zlib plugin. While searching for something, I landed on a github gist page pointing to a blog post with good enough script for the job. The problem however was that the script wasn't really showing any output and I wanted it to be easier to run against multiple directories with one run.

So what's new?

I've added a simple "progress bar" to show which directory is currently being worked on - useful when you have a (couple) of terabyte(s) of e-mails to compress. Added different command line arguments, so you can use the script for both compressing and decompressing mails. Also you can chose between the 3 compression types supported by the dovecot zlib plugin. You can select message file age (eg how long a go it was added to the directory), which allows you to compress mails after a certain amount of time. Still testing? There is debug mode.

Usage

Compress mails older thant 60 days with xz

/path/to/dovecot-maildir-compress -c -l -t 60 /path/to/maildir

Decompress all mails using bzip2

/path/to/dovecot-maildir-compress -d -b -t 0 /path/to/maildir

TODO:

  • Add file autodetection, to be able to decompress compressed mails, no matter the compression type. Useful if we have mails not compressed with this script and/or multiple types.
  • Move the debug messages in a separate function, tidy up the code. Output debug to stderr instead of stdout.
  • Pass multiple dirs as arguments to the script
  • Fix the following line to use dirname or realpath instead of cd && pwd:
tmpdir=$(cd "$maildir/../tmp" &>/dev/null && pwd) || exit 1

dovecot-maildir-compress's People

Contributors

george-ng avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.