1MU EXTRACT(1) General Commands Manual MU EXTRACT(1)
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 [common-options] extract [options] <file>
12
13
14 mu [common-options] extract [options] <file> <pattern>
15
16
18 mu extract is the mu sub-command for extracting MIME-parts (e.g., at‐
19 tachments) from mail messages. The sub-command works on message files,
20 and does not require the message to be indexed in the database.
21
22
23 For attachments, the file name used when saving it is the name of the
24 attachment in the message. If there is no such name, or when saving
25 non-attachment MIME-parts, a name is derived from the message-id of the
26 message.
27
28
29 If you specify a regular express pattern as the second argument, all
30 attachments with filenames matching that pattern will be extracted. The
31 regular expressions are basic PCRE, and are case-sensitive by default;
32 see pcre(3) for more details.
33
34
35 Without any options, mu extract simply outputs the list of leaf MIME-
36 parts in the message. Only 'leaf' MIME-parts (including RFC822 attach‐
37 ments) are considered, multipart/* etc. are ignored.
38
39
41 -a, --save-attachments
42 save all MIME-parts that look like attachments.
43
44
45 --save-all
46 save all non-multipart MIME-parts.
47
48
49 --parts=<parts>
50 only consider the following numbered parts (comma-separated list). The
51 numbers for the parts can be seen from running mu extract without any
52 options but only the message file.
53
54
55 --target-dir=<dir>
56 save the parts in the target directory rather than the current working
57 directory.
58
59
60 --overwrite
61 overwrite existing files with the same name; by default overwriting is
62 not allowed.
63
64
65 -u,--uncooked
66 by default, mu transforms the attachment filenames a bit (such as by
67 replacing spaces by dashes); with this option, leave that to the mini‐
68 mum for creating a legal filename in the target directory.
69
70
71 --play
72 Try to 'play' (open) the attachment with the default application for
73 the particular file type. On MacOS, this uses the open program, on
74 other platforms it uses xdg-open. You can choose a different program by
75 setting the MUPLAYPROGRAM environment variable.
76
77
79 -d, --debug
80 makes mu generate extra debug information, useful for debugging the
81 program itself. By default, debug information goes to the log file,
82 ~/.cache/mu/mu.log. It can safely be deleted when mu is not running.
83 When running with --debug option, the log file can grow rather quickly.
84 See the note on logging below.
85
86
87 -q, --quiet
88 causes mu not to output informational messages and progress information
89 to standard output, but only to the log file. Error messages will still
90 be sent to standard error. Note that mu index is much faster with
91 --quiet, so it is recommended you use this option when using mu from
92 scripts etc.
93
94
95 --log-stderr
96 causes mu to not output log messages to standard error, in addition to
97 sending them to the log file.
98
99
100 --nocolor
101 do not use ANSI colors. The environment variable NO_COLOR can be used
102 as an alternative to --nocolor.
103
104
105 -V, --version
106 prints mu version and copyright information.
107
108
109 -h, --help
110 lists the various command line options.
111
112
114 To display information about all the MIME-parts in a message file:
115 $ mu extract msgfile
116
117
118
119 To extract MIME-part 3 and 4 from this message, overwriting existing
120 files with the same name:
121 $ mu extract --parts=3,4 --overwrite msgfile
122
123
124
125 To extract all files ending in '.jpg' (case-insensitive):
126 $ mu extract msgfile '.*.jpg'
127
128
129
130 To extract an mp3-file, and play it in the default mp3-playing applica‐
131 tion:
132 $ mu extract --play msgfile 'whoopsididitagain.mp3'
133
134
135
137 Please report bugs at https://github.com/djcb/mu/issues.
138
139
141 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
142
143
145 This manpage is part of mu 1.10.5.
146
147
148 Copyright © 2022-2023 Dirk-Jan C. Binnema. License GPLv3+: GNU GPL ver‐
149 sion 3 or later https://gnu.org/licenses/gpl.html. This is free soft‐
150 ware: you are free to change and redistribute it. There is NO WARRANTY,
151 to the extent permitted by law.
152
153
155 mu(1)
156
157
158
159 MU EXTRACT(1)