Search code examples
mutt

how to use mutt to attach and send files recursively


I would like to attach all .csv files from /home/john recursively, something like the following would be fine but only attaches all .csv files from /home/john/ it doesnt include all the sub folders of /home/john/

mutt  -s "all csv files" me@mail.com -a /home/john/*.csv < /home/john/message.txt

but what if I can do this and if there happens to be a .csv file in one of the sub folders with the same name? eg /home/john/1.csv and /home/john/tom/1.csv what will happen? will it still be attached?

thanks


Solution

  • No that command wont't find *.csv in subdirectories. You may want to use find and xargs, something like this:

    find /home/john -name \*.csv | xargs mutt  -s "all csv files" me@mail.com -i /home/john/message.txt -a
    

    I think -i would have the same effect as < from the file.