aboutsummaryrefslogtreecommitdiffstats
path: root/archivemail.py
diff options
context:
space:
mode:
authorPaul Rodger <paul@paulrodger.com>2002-04-27 06:08:45 +0000
committerPaul Rodger <paul@paulrodger.com>2002-04-27 06:08:45 +0000
commitbc41b683898797b07db49a929656ed644cfefd53 (patch)
treedfcf388b438ed4b1ef329c7b2a0c26e5aac6099e /archivemail.py
parenta9920b731d1968e194911e2f265c5233e9a92ac4 (diff)
downloadarchivemail-bc41b683898797b07db49a929656ed644cfefd53.tar.gz
archivemail-bc41b683898797b07db49a929656ed644cfefd53.tar.bz2
archivemail-bc41b683898797b07db49a929656ed644cfefd53.zip
Fixed a bug where the long --suffix option was not working (although the
short option, '-s' was). Added time-based format directives to the --suffix option, so that you can do things like specify --suffix='%B%Y' to create archives named after the current month and year. Added some more tests to test_archivemail.py
Diffstat (limited to 'archivemail.py')
-rwxr-xr-xarchivemail.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/archivemail.py b/archivemail.py
index 7aa2424..30c06f5 100755
--- a/archivemail.py
+++ b/archivemail.py
@@ -22,7 +22,7 @@ Website: http://archivemail.sourceforge.net/
"""
# global administrivia
-__version__ = "archivemail v0.4.3"
+__version__ = "archivemail v0.4.4"
__cvs_id__ = "$Id$"
__copyright__ = """Copyright (C) 2002 Paul Rodger <paul@paulrodger.com>
This is free software; see the source for copying conditions. There is NO
@@ -165,7 +165,7 @@ class Options:
opts, args = getopt.getopt(args, '?D:Vd:hno:qs:uv',
["date=", "days=", "delete", "dry-run", "help",
"include-flagged", "no-compress", "output-dir=",
- "preserve-unread", "quiet", "suffix", "verbose",
+ "preserve-unread", "quiet", "suffix=", "verbose",
"version", "warn-duplicate"])
except getopt.error, msg:
user_error(msg)
@@ -858,7 +858,11 @@ def archive(mailbox_name):
set_signal_handlers()
os.umask(077) # saves setting permissions on mailboxes/tempfiles
- final_archive_name = mailbox_name + options.archive_suffix
+ # allow the user to embed time formats such as '%B' in the suffix string
+ parsed_suffix = time.strftime(options.archive_suffix,
+ time.localtime(time.time()))
+
+ final_archive_name = mailbox_name + parsed_suffix
if options.output_dir:
final_archive_name = os.path.join(options.output_dir,
os.path.basename(final_archive_name))