Eric H. wrote:
I’ve written parts one and two:
http://seattlerb.rubyforge.org/IMAPCleanse/
Nice work… I did something to deal with my own Maildir overflowage,
though it’s simpler and infinitely more hacky. But, it’s been working
well for me for quite awhile now.
–Steve
[swaits@gateway] [4:07pm]
[~] 140> cat bin/archive-Maildir.rb
#!/usr/local/bin/ruby
archive_list = [
[“.Lists.GDAlgorithms”, “.Archive.Lists.GDAlgorithms”, 28],
[“.Lists.LocomotiveUsers”, nil, 14],
[“.Lists.Mongrel”, nil, 14],
[“.Lists.RubyTalk”, nil, 14],
[“.Lists.SANS”, nil, 28],
[“.Lists.SDRUG”, “.Archive.Lists.SDRUG”, 28],
[“.Junk”, nil, 7],
]
Dir.chdir(“/usr/users/swaits/Maildir”)
i = 0
archive_list.each do |archive|
srcdir = archive[0] + “/cur/”
dstdir = archive[1] ? archive[1] + “/cur/” : nil
expire = archive[2]
Dir[srcdir+"*"].each do |oldname|
age_s = Time.new - File.mtime(oldname)
if age_s > (expire*24*60*60)
if dstdir
if File.split(oldname)[1] =~
/^\d+[^:](:.)?$/
newname =
sprintf(“#{dstdir}/%d.%d.autoarchive.%07d%s”, Time.now.to_i,
Process.pid, i, Regexp.last_match(1))
i += 1
#puts “#{oldname} →
#{newname}”
File.rename(oldname, newname)
end
else
File.delete(oldname)
#puts “delete #{oldname}”
end
end
#rescue SystemCallError
# puts “Error moving #{oldname} → #{newname}”
#end
end
end