Created
September 25, 2013 13:14
-
-
Save jiphex/6699405 to your computer and use it in GitHub Desktop.
Mark all mail (and maildirs, recursively) as read within the given Maildir. Requires the 'maildir' gem.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'maildir' | |
class Maildir | |
def subdirectories | |
dirs = Dir.glob(File.join(@path,"*")).find_all{|a|File.directory?(a)} | |
dirs.map{|a|Maildir.new(a)} | |
end | |
def read_all! | |
self.list(:new).each{|l|l.process} | |
self.list(:cur).each{|m|m.seen!} | |
end | |
end | |
START_DIR="~/Maildir" | |
md = Maildir.new(START_DIR) | |
md.read_all! | |
md.subdirectories.each do |s| | |
s.read_all! | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment