.TH MU-EXTRACT 1 "July 2012" "User Manuals" .SH NAME mu_extract \- display and save message parts (attachments), and open them with other tools. .SH SYNOPSIS .B mu extract [options] .B mu extract [options] .SH DESCRIPTION \fBmu extract\fR is the \fBmu\fR 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. 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. If you specify a pattern (a case-insensitive regular expression) as the second argument, all attachments with filenames matching that pattern will be extracted. The regular expressions are Perl-compatible (as per the PCRE-library). Without any options, \fBmu extract\fR simply outputs the list of leaf MIME-parts in the message. Only 'leaf' MIME-parts (including RFC822 attachments) are considered, \fBmultipart/*\fR etc. are ignored. .SH OPTIONS .TP \fB\-a\fR, \fB\-\-save\-attachments\fR save all MIME-parts that look like attachments. .TP \fB\-\-save\-all\fR save all non-multipart MIME-parts. .TP \fB\-\-parts\fR= only consider the following numbered parts (comma-separated list). The numbers for the parts can be seen from running \fBmu extract\fR without any options but only the message file. .TP \fB\-\-target\-dir\fR= save the parts in the target directory rather than the current working directory. .TP \fB\-\-overwrite\fR overwrite existing files with the same name; by default overwriting is not allowed. .TP \fB\-\-play\fR Try to 'play' (open) the attachment with the default application for the particular file type. On MacOS, this uses the \fBopen\fR program, on other platforms it uses \fBxdg-open\fR. You can choose a different program by setting the \fBMU_PLAY_PROGRAM\fR environment variable. .SH EXAMPLES To display information about all the MIME-parts in a message file: .nf $ mu extract msgfile .fi To extract MIME-part 3 and 4 from this message, overwriting existing files with the same name: .nf $ mu extract --parts=3,4 --overwrite msgfile .fi To extract all files ending in '.jpg' (case-insensitive): .nf $ mu extract msgfile '.*\.jpg' .fi To extract an mp3-file, and play it in the default mp3-playing application: .nf $ mu extract --play msgfile 'whoopsididitagain.mp3' .fi .SH BUGS Please report bugs if you find them: .BR https://github.com/djcb/mu/issues .SH AUTHOR Dirk-Jan C. Binnema .SH "SEE ALSO" .BR mu (1)