|
| 1 | +MU EXTRACT(1) General Commands Manual MU EXTRACT(1) |
| 2 | + |
| 3 | +NAME |
| 4 | + mu-extract - display and save message parts (attachments), and open |
| 5 | + them with other tools. |
| 6 | + |
| 7 | +SYNOPSIS |
| 8 | + mu [COMMON-OPTIONS] extract [OPTIONS] [FILE] |
| 9 | + |
| 10 | + |
| 11 | + mu [COMMON-OPTIONS] extract [OPTIONS] FILE PATTERN |
| 12 | + |
| 13 | +DESCRIPTION |
| 14 | + mu extract is the mu sub-command for extracting MIME-parts (e.g., |
| 15 | + attachments) from mail messages. The sub-command works on message |
| 16 | + files, and does not require the message to be indexed in the database. |
| 17 | + |
| 18 | + |
| 19 | + For attachments, the file name used when saving it is the name of the |
| 20 | + attachment in the message. If there is no such name, or when saving |
| 21 | + non-attachment MIME-parts, a name is derived from the message-id of the |
| 22 | + message. |
| 23 | + |
| 24 | + |
| 25 | + If you specify a regular express pattern as the second argument, all |
| 26 | + attachments with filenames matching that pattern will be extracted. The |
| 27 | + regular expressions are basic PCRE, and are case-sensitive by default; |
| 28 | + see pcre(3) for more details. |
| 29 | + |
| 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 |
| 33 | + attachments) are considered, multipart/* etc. are ignored. |
| 34 | + |
| 35 | + |
| 36 | + Without a filename parameter, mu extract reads a message from standard- |
| 37 | + input. In that case, you cannot use the second, PATTERN parameter as |
| 38 | + this would be ambiguous; instead, use the --matches option. |
| 39 | + |
| 40 | +EXTRACT OPTIONS |
| 41 | + -a, --save-attachments |
| 42 | + Save all MIME-parts that look like attachments. |
| 43 | + |
| 44 | + --save-all |
| 45 | + Save all non-multipart MIME-parts. |
| 46 | + |
| 47 | + --parts parts |
| 48 | + Only consider the following numbered parts (comma-separated list). The |
| 49 | + numbers for the parts can be seen from running mu extract without any |
| 50 | + options but only the message file. |
| 51 | + |
| 52 | + --target-dir dir |
| 53 | + Save the parts in dir rather than the current working directory. |
| 54 | + |
| 55 | + --overwrite |
| 56 | + Overwrite existing files with the same name; by default overwriting is |
| 57 | + not allowed. |
| 58 | + |
| 59 | + -u,--uncooked |
| 60 | + By default, mu transforms the attachment filenames a bit (such as by |
| 61 | + replacing spaces by dashes); with this option, leave that to the |
| 62 | + minimum for creating a legal filename in the target directory. |
| 63 | + |
| 64 | + --matches pattern |
| 65 | + Attachments with filenames matching pattern will be extracted. The |
| 66 | + regular expressions are basic PCRE, and are case-sensitive by default; |
| 67 | + see pcre(3) for more details. |
| 68 | + |
| 69 | + --play |
| 70 | + Try to `play' (open) the attachment with the default application for |
| 71 | + the particular file type. On MacOS, this uses the open program, on |
| 72 | + other platforms it uses xdg-open. You can choose a different program by |
| 73 | + setting the MU_PLAY_PROGRAM environment variable. |
| 74 | + |
| 75 | +COMMON OPTIONS |
| 76 | + -d, --debug |
| 77 | + Makes mu generate extra debug information, useful for debugging the |
| 78 | + program itself. Debug information goes to the standard logging |
| 79 | + location; see mu(1). |
| 80 | + |
| 81 | + -q, --quiet |
| 82 | + Causes mu not to output informational messages and progress information |
| 83 | + to standard output, but only to the log file. Error messages will still |
| 84 | + be sent to standard error. Note that mu index is much faster with |
| 85 | + --quiet, so it is recommended you use this option when using mu from |
| 86 | + scripts etc. |
| 87 | + |
| 88 | + --log-stderr |
| 89 | + Causes mu to not output log messages to standard error, in addition to |
| 90 | + sending them to the standard logging location. |
| 91 | + |
| 92 | + --nocolor |
| 93 | + Do not use ANSI colors. The environment variable NO_COLOR can be used |
| 94 | + as an alternative to --nocolor. |
| 95 | + |
| 96 | + -V, --version |
| 97 | + Prints mu version and copyright information. |
| 98 | + |
| 99 | + -h, --help |
| 100 | + Lists the various command line options. |
| 101 | + |
| 102 | +EXAMPLES |
| 103 | + To display information about all the MIME-parts in a message file: |
| 104 | + $ mu extract msgfile |
| 105 | + |
| 106 | + |
| 107 | + |
| 108 | + To extract MIME-part 3 and 4 from this message, overwriting existing |
| 109 | + files with the same name: |
| 110 | + $ mu extract --parts=3,4 --overwrite msgfile |
| 111 | + |
| 112 | + |
| 113 | + |
| 114 | + To extract all files ending in `.jpg' (case-insensitive): |
| 115 | + $ mu extract msgfile '.*\.jpg' |
| 116 | + |
| 117 | + |
| 118 | + |
| 119 | + To extract an mp3-file, and play it in the default mp3-playing |
| 120 | + application: |
| 121 | + $ mu extract --play msgfile 'whoopsididitagain.mp3' |
| 122 | + |
| 123 | + |
| 124 | + |
| 125 | + when reading from standard-input, you need --matches, so: |
| 126 | + $ cat msgfile | mu extract --play --matches 'whoopsididitagain.mp3' |
0 commit comments