.TH "MU EXTRACT" "1" .SH "NAME" .PP \fBmu\d\s-2extract\s+2\u\fP - display and save message parts (attachments), and open them with other tools. .SH "SYNOPSIS" .PP \fBmu [common-options] extract [options] \fP .PP \fBmu [common-options] extract [options] \fP .SH "DESCRIPTION" .PP \fBmu extract\fP is the \fBmu\fP sub-command for extracting MIME-parts (e.g., attachments) from mail messages. The sub-command works on message files, and does not require the message to be indexed in the database. .PP For attachments, the file name used when saving it is the name of the attachment in the message. If there is no such name, or when saving non-attachment MIME-parts, a name is derived from the message-id of the message. .PP If you specify a regular express pattern as the second argument, all attachments with filenames matching that pattern will be extracted. The regular expressions are basic PCRE, and are case-sensitive by default; see \fBpcre(3)\fP for more details. .PP Without any options, \fBmu extract\fP simply outputs the list of leaf MIME-parts in the message. Only 'leaf' MIME-parts (including RFC822 attachments) are considered, \fBmultipart/*\fP etc. are ignored. .SH "EXTRACT OPTIONS" .SS "-a, --save-attachments" .PP save all MIME-parts that look like attachments. .SS "--save-all" .PP save all non-multipart MIME-parts. .SS "--parts=" .PP only consider the following numbered parts (comma-separated list). The numbers for the parts can be seen from running \fBmu extract\fP without any options but only the message file. .SS "--target-dir=" .PP save the parts in the target directory rather than the current working directory. .SS "--overwrite" .PP overwrite existing files with the same name; by default overwriting is not allowed. .SS "-u,--uncooked" .PP by default, \fBmu\fP transforms the attachment filenames a bit (such as by replacing spaces by dashes); with this option, leave that to the minimum for creating a legal filename in the target directory. .SS "--play" .PP Try to 'play' (open) the attachment with the default application for the particular file type. On MacOS, this uses the \fBopen\fP program, on other platforms it uses \fBxdg-open\fP. You can choose a different program by setting the \fBMU\d\s-2PLAY\s+2\u\d\s-2PROGRAM\s+2\u\fP environment variable. .SH "COMMON OPTIONS" .SS "-d, --debug" .PP makes mu generate extra debug information, useful for debugging the program itself. By default, debug information goes to the log file, ~/.cache/mu/mu.log. It can safely be deleted when mu is not running. When running with --debug option, the log file can grow rather quickly. See the note on logging below. .SS "-q, --quiet" .PP causes mu not to output informational messages and progress information to standard output, but only to the log file. Error messages will still be sent to standard error. Note that mu index is much faster with --quiet, so it is recommended you use this option when using mu from scripts etc. .SS "--log-stderr" .PP causes mu to not output log messages to standard error, in addition to sending them to the log file. .SS "--nocolor" .PP do not use ANSI colors. The environment variable \fBNO\d\s-2COLOR\s+2\u\fP can be used as an alternative to \fB--nocolor\fP. .SS "-V, --version" .PP prints mu version and copyright information. .SS "-h, --help" .PP lists the various command line options. .SH "EXAMPLES" .PP To display information about all the MIME-parts in a message file: .RS .nf $ mu extract msgfile .fi .RE .PP To extract MIME-part 3 and 4 from this message, overwriting existing files with the same name: .RS .nf $ mu extract --parts=3,4 --overwrite msgfile .fi .RE .PP To extract all files ending in '.jpg' (case-insensitive): .RS .nf $ mu extract msgfile '.*\.jpg' .fi .RE .PP To extract an mp3-file, and play it in the default mp3-playing application: .RS .nf $ mu extract --play msgfile 'whoopsididitagain.mp3' .fi .RE .SH "REPORTING BUGS" .PP Please report bugs at \fIhttps://github.com/djcb/mu/issues\fP. .SH "AUTHOR" .PP Dirk-Jan C. Binnema .SH "COPYRIGHT" .PP This manpage is part of \fBmu\fP 1.10.8. .PP Copyright © 2022-2023 Dirk-Jan C. Binnema. License GPLv3+: GNU GPL version 3 or later \fIhttps://gnu.org/licenses/gpl.html\fP. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. .SH "SEE ALSO" .PP \fBmu(1)\fP