Skip to content

Instantly share code, notes, and snippets.

@mrmt
Created October 12, 2012 09:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrmt/3878288 to your computer and use it in GitHub Desktop.
Save mrmt/3878288 to your computer and use it in GitHub Desktop.
rename mail file within Maildir to seen status
#!/usr/bin/perl
# rename mail file within Maildir to seen status
use strict;
use warnings;
my $file = shift;
die unless -r $file;
die unless -f $file;
my ($base, $flag) = ($file =~ /^(.*),(\w+)$/);
exit 0 if $flag =~ /S/; # exit already seen
exit 1 unless rename $file, $base . ',S' . $flag;
exit 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment