Maneesh Patel
2012-03-03 02:17:49 UTC
I would like to define a mutt macro to save attachments to a
particular directory with an improved filename. The following line in
my .muttrc file:
macro attach S "<save-entry><bol>$HOME/Mail/Attachments/<eol>"
does half of what I want: it allows me to save the attachment with its
original filename to the desired directory. I would like to save the
attachment with a new filename, however, in which all spaces are
replaced by underscores, all letters are changed to lowercase, and all
single-close-quote marks are removed.* In other words, if possible I
would like my .muttrc macro to do something like execute the bash
command
echo $filename | tr 'A-Z' 'a-z' | sed "s/'//g" | sed "s/ /_/g"
and use the output as the new filename under which to save the
attachment in the desired directory. Is this possible?
Kind regards,
--maneesh
*If I could convince my friends using Windows to stop sending me Word
documents with poor filenames that would solve the problem, but I'm
not too optimistic about this solution.
particular directory with an improved filename. The following line in
my .muttrc file:
macro attach S "<save-entry><bol>$HOME/Mail/Attachments/<eol>"
does half of what I want: it allows me to save the attachment with its
original filename to the desired directory. I would like to save the
attachment with a new filename, however, in which all spaces are
replaced by underscores, all letters are changed to lowercase, and all
single-close-quote marks are removed.* In other words, if possible I
would like my .muttrc macro to do something like execute the bash
command
echo $filename | tr 'A-Z' 'a-z' | sed "s/'//g" | sed "s/ /_/g"
and use the output as the new filename under which to save the
attachment in the desired directory. Is this possible?
Kind regards,
--maneesh
*If I could convince my friends using Windows to stop sending me Word
documents with poor filenames that would solve the problem, but I'm
not too optimistic about this solution.