GFI Software

Welcome to the GFI Software community forum! For support please open a ticket from https://support.gfi.com.

Home » GFI User Forums » Kerio Connect » Convert mail archive from daily to monthly
Convert mail archive from daily to monthly [message #118370] Mon, 29 December 2014 07:14 Go to next message
r1sh is currently offline  r1sh
Messages: 91
Registered: August 2014
Location: Russia
Hello!

We've got mail dailty mail archive, is there any script or way to convert them to monthly mail archive?
Re: Convert mail archive from daily to monthly [message #118372 is a reply to message #118370] Mon, 29 December 2014 18:14 Go to previous messageGo to next message
Machete
Messages: 187
Registered: February 2012
Location: United States
Hello -

Here are 2 scripts I ran on my Linux box (I'm currently running Kerio on Windows). What these did (when placed in daily cron job) is:
Step 1: create a folder for the current Year/Month named YYYY-MM
Step 2: Move previous day's archive into the month folder
Step 3: Archive/Compress (.ZIP) the 13th oldest Month folder so I only ever had 12 months of uncompressed email in the archive - but could easily uncompress/restore a particular time period if I needed to find something specific.

Make Folder/Move Date (Steps 1 & 2)
#!/bin/bash

cd /opt/kerio/mailserver/store/archive
mkdir -p $(date --date=yesterday +%Y-%m)
mv $(date --date=yesterday +%Y-%b-%d) $(date --date=yesterday +%Y-%m)


Archive/Compress 13 month old folder (Step 3)
#!/bin/bash

cd /mnt/opt/kerio/mailserver/store/archive
archive_folder=$(date --date="13 months ago" +%Y/%Y-%m)
zip -s 2000m -r $archive_folder.zip $archive_folder
rm -rf $archive_folder


NOTE: Use these at your own risk - I only recommend implementing if you have working knowledge of Linux. As always, backup your data before running and test on a non-production server.

Edit: Correct a couple typo-s

[Updated on: Mon, 29 December 2014 18:15]

Report message to a moderator

Re: Convert mail archive from daily to monthly [message #118404 is a reply to message #118372] Wed, 31 December 2014 16:32 Go to previous messageGo to next message
r1sh is currently offline  r1sh
Messages: 91
Registered: August 2014
Location: Russia
hello!

actually it isn't what i need.

There is mail archive, a folder which contains all incoming and outgoing letters.

The previos server configuration was to make each day new folder and place in it all mail.

Some days ago I switched it to making only each month new folder.

And I don't know how to convert all letters from previos days, because each day contains file with name 0000000 and 0000000a and so on...
Re: Convert mail archive from daily to monthly [message #119518 is a reply to message #118404] Thu, 19 February 2015 01:13 Go to previous messageGo to next message
Machete
Messages: 187
Registered: February 2012
Location: United States
You want to:
- convert messages in archive folders by day to folders by month
or
- convert messages in archive folders by month to day

In either case, I would log into the Webmail and move the messages into folders how you want. I would not mess with moving messages from within the message store.
Re: Convert mail archive from daily to monthly [message #119520 is a reply to message #119518] Thu, 19 February 2015 08:08 Go to previous message
r1sh is currently offline  r1sh
Messages: 91
Registered: August 2014
Location: Russia
Hello!

I want:

convert messages in archive folders by day to folders by month

Isn't it a really long work:

eneter every day, select letters on every page and copy them?

[Updated on: Thu, 19 February 2015 08:09]

Report message to a moderator

Previous Topic: Outlook 15.6 and IMAP folders
Next Topic: Malformed MIME content causing all mail to be rejected
Goto Forum:
  


Current Time: Sat Sep 30 04:00:04 CEST 2023

Total time taken to generate the page: 0.06586 seconds