21

You can save all attachments via

  1. tag all attachments via hitting t
  2. ;
  3. s
  4. choose destination directory and hit a (all)

This works but has following severe side effect: you have to hit n-times enter for n attachments.

That means even if there are no file name collisions in the destination directory.

This is also documented in the Mutt FAQ.

Very inconvenient.

Some mutt users seem to recommend piping messages to munpack (example message linked). Good idea - but how to make Mutt prompt for a destination directory (as part of a munpack invoking macro)?

How do I construct such a macro? Or are there better solutions to this issue?

1
  • I believe the reason no one has answered your question with a mutt macro, is because <tag-pattern> does not work in attachment mode. There is, therefore, no way to programmatically tag all attachments (a necessary condition to being able to do something useful with all of them).
    – user3356
    Dec 14 '16 at 19:32
14

You could pipe the message to ripmime, which lets you specify a destination directory on the command line...e.g.:

ripmime -i - -d ~/myfiles/

The -i - tells ripmime to read from standard input, and -d specifies a destination directory. If that's too much typing, stick it in a shell script and call that (which will also make it easier if you want to use other of ripmime's many options for controlling its behavior).

If you add a macro like this to your configuration:

macro index,pager X "<pipe-message>ripmime -i - -d "

Then you can press "X", enter a destination directory, and press <RETURN> to run the command.

4
  • 1
    Fantastic! Too bad I can upvote only once. What's really great about this solution is it works for multiple messages as well. Just tag 'em and ;|. Dec 14 '14 at 15:21
  • Very nice, didn't work for multiple tagged message though, @AryehLeibTaurog you just press t and then X?
    – Alex
    Dec 11 '18 at 18:50
  • @Alex t to tag, ;, to operate on all tagged messages, then | and the command to which you want to pipe. (That isn’t an emoticon, it’s the command.) If you want to use the macro above, the combination is t;X. Dec 12 '18 at 15:13
  • Careful @AryehLeibTaurog, on my system it seems to work but it doesn't, it extracts some file but not all, and it gives no errors, if I use a shell for loop and pipe the mail files to ripmime it works, maybe because I'm using Maildir and not mbox
    – Alex
    Jan 23 '19 at 22:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.