1MU(EXTRACT) User Manuals MU(EXTRACT)
2
3
4
6 mu extract is the mu command to display and save message parts (attach‐
7 ments), and open them with other tools.
8
9
11 mu extract [options] <file>
12
13 mu extract [options] <file> <pattern>
14
15
17 mu extract is the mu sub-command for extracting MIME-parts (e.g.,
18 attachments) from mail messages. The sub-command works on message
19 files, and does not require the message to be indexed in the database.
20
21 For attachments, the file name used when saving it is the name of the
22 attachment in the message. If there is no such name, or when saving
23 non-attachment MIME-parts, a name is derived from the message-id of the
24 message.
25
26 If you specify a pattern (a case-insensitive regular expression) as the
27 second argument, all attachments with filenames matching that pattern
28 will be extracted. The regular expressions are Perl-compatible (as per
29 the PCRE-library).
30
31 Without any options, mu extract simply outputs the list of leaf MIME-
32 parts in the message. Only 'leaf' MIME-parts (including RFC822 attach‐
33 ments) are considered, multipart/* etc. are ignored.
34
35
37 -a, --save-attachments
38 save all MIME-parts that look like attachments.
39
40
41 --save-all
42 save all non-multipart MIME-parts.
43
44
45 --parts=<parts>
46 only consider the following numbered parts (comma-separated
47 list). The numbers for the parts can be seen from running mu
48 extract without any options but only the message file.
49
50
51 --target-dir=<dir>
52 save the parts in the target directory rather than the current
53 working directory.
54
55
56 --overwrite
57 overwrite existing files with the same name; by default over‐
58 writing is not allowed.
59
60
61 --play Try to 'play' (open) the attachment with the default
62 application for the particular file type. On MacOS, this uses
63 the open program, on other platforms it uses xdg-open. You can
64 choose a different program by setting the MU_PLAY_PROGRAM envi‐
65 ronment variable.
66
67
69 To display information about all the MIME-parts in a message file:
70 $ mu extract msgfile
71
72 To extract MIME-part 3 and 4 from this message, overwriting existing
73 files with the same name:
74 $ mu extract --parts=3,4 --overwrite msgfile
75
76 To extract all files ending in '.jpg' (case-insensitive):
77 $ mu extract msgfile '.*.jpg'
78
79 To extract an mp3-file, and play it in the default mp3-playing applica‐
80 tion:
81 $ mu extract --play msgfile 'whoopsididitagain.mp3'
82
83
85 Please report bugs if you find them: https://github.com/djcb/mu/issues
86
87
89 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
90
91
93 mu(1)
94
95
96
97July 2012 1 MU(EXTRACT)