<<< Date Index >>>     <<< Thread Index >>>

Re: Save multiple attachements at once. [patch]



Re: Bill Moseley in <20040303210719.GA2455@xxxxxxxx>
> > What if you want to save all the attachments with their original
> > filenames in a different directory from your working directory?
> 
> Yes, that was the question.  I get sent a collection of attachements and
> I want quickly dump all 200 of them into a single (likely new)
> directory.

The ability to save to a directory was introduced about ~2 months ago,
so check out Mutt 1.5.x (x >= ~5).

You still have to press <enter> to confirm every filename even if you've
answered "(a)ll". The following patch saves all attachments without
re-asking for each file:

RCS file: /home/roessler/cvs/mutt/recvattach.c,v
retrieving revision 3.12
diff -u -r3.12 recvattach.c
--- recvattach.c        4 Oct 2003 20:35:00 -0000       3.12
+++ recvattach.c        4 Mar 2004 14:33:04 -0000
@@ -384,15 +384,18 @@
          body->encoding != ENCQUOTEDPRINTABLE &&
          mutt_is_message_type(body->type, body->subtype))
     mutt_default_save(buf, sizeof(buf), body->hdr);
+  else if (directory && *directory)
+    strfcpy (buf, *directory, sizeof (buf));
   else
     buf[0] = 0;
 
   prompt = _("Save to file: ");
   while (prompt)
   {
-    if (mutt_get_field (prompt, buf, sizeof (buf), M_FILE | M_CLEAR) != 0
-       || !buf[0])
-      return -1;
+    if (!directory || !*directory || !body->filename || !*body->filename)
+      if (mutt_get_field (prompt, buf, sizeof (buf), M_FILE | M_CLEAR) != 0
+         || !buf[0])
+       return -1;
     
     prompt = NULL;
     mutt_expand_path (buf, sizeof (buf));

Christoph
-- 
cb@xxxxxxxx | http://www.df7cb.de/

Attachment: signature.asc
Description: Digital signature