Qmail Support Forum Forum Index Qmail Support Forum
Qmail Email Server Support Forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Deleting archived mails

 
Post new topic   Reply to topic    Qmail Support Forum Forum Index -> Mail Servers
View previous topic :: View next topic  
Author Message
admin
Site Admin


Joined: 21 Jun 2005
Posts: 209

PostPosted: Mon Jul 24, 2006 4:39 pm    Post subject: Deleting archived mails Reply with quote

Hello everybody on the list. I thought I post an update of my problem
and its current work-around.

The goal was to delete archived e-mails which are older than xx days.
The machine archives roughly 2-5 GB of data / day of 400+ users.

The e-mail are archived on a daily basis foldername something like YYYY-MM.


First approach:

find /mailarchive/ -mtime +30 -type f -exec /bin/rm -rf {} \;

didnt work as expected. The command doesnt cope with the amount of small files


Second approach:

find /tmp/test/ -mtime +30 -type f | xargs /bin/rm -f

Also didnt work. Probably same cause as the first approach.

My guess is that the commands arguements passed from find to xargs is
just to much for the commands arguments buffer of the OS.


Anyway I got those valuables replies from Greg,Devdas,Scott and Jorey.
So unfortunately I cant change the way the data is archived, because
it is a commercial solution (bad enough ;- ( ).

So I have to life with the structure and go from there. After some
going inside of me I came up with looking for the structure in which
the files are stored.

Evt. after some trial and error I figured that its best to approach it
by the folders names instead of the files metadata.

So I finally ended up with a simple command like

rm -rf /mailarchive/`date -d '1 month ago' +%Y-%m`/`date -d '1 month
ago' +%Y-%m-%d`

which works now beautifully.

date -d '1 month ago' +%Y-%m will output something like "2006-06"
which is the folders name and analog to it "date -d '1 month ago'
+%Y-%m-%d" will name and remove the subfolder.

That is the closest that I could come up with for now.

I guess I have to leave the fun of debugging the command line buffers
for a boring weekend in the cold winter Wink

Once more thank you for any replies, it was much appreciated.

Best regards

Nils Valentin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Qmail Support Forum Forum Index -> Mail Servers All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group. Hosted by phpBB.BizHat.com


For Support - http://forums.BizHat.com

Free Web Hosting | Free Forum Hosting | FlashWebHost.com | Image Hosting | Photo Gallery | FreeMarriage.com

Powered by PhpBBweb.com, setup your forum now!