From d0aa685788ec2071b220ee6c9065a56dc51efd56 Mon Sep 17 00:00:00 2001 From: Brian Murray Date: Mon, 18 Apr 2011 11:16:16 -0700 Subject: [PATCH] grab-attachments: put attachments in a folder named after the bug number which prevents clobbering of attachments if multiple bugs have the same attachment name --- grab-attachments | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/grab-attachments b/grab-attachments index 51771cc..71ca344 100755 --- a/grab-attachments +++ b/grab-attachments @@ -56,6 +56,9 @@ def main(): bug = launchpad.bugs[number] + os.mkdir('bug-%s' % number) + os.chdir('bug-%s' % number) + for attachment in bug.attachments: f = attachment.data.open() filename = os.path.join(os.getcwd(), f.filename) @@ -64,6 +67,8 @@ def main(): f.close() local_file.close() + os.chdir('../') + # no LP credentials except IOError, error: print error