From bc41b683898797b07db49a929656ed644cfefd53 Mon Sep 17 00:00:00 2001 From: Paul Rodger Date: Sat, 27 Apr 2002 06:08:45 +0000 Subject: 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 --- archivemail.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'archivemail.py') 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 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)) -- cgit v1.2.3