3

I got a script running (as cronjob) that will list the files in a folder before doing a Rsync job and emailing me the list. How can I add a subject line.

find /path/to/folder/ -type f -size +1M -name "*.mov" -printf "%f\n" | ssmtp [email protected]

I tried this with -s "Subject" but no luck. It only works if I put the subject in a text file and call this text file

find /path/to/folder/ -type f -size +1M -name "*.mov" -printf "%f\n" | [email protected] < /path/to/file/subjectline.txt

But than it won't add the search results in the Message.

Any thoughts on what I am doing wrong,

Bas

1 Answer 1

10

Try this:

{
    echo To: [email protected]
    echo From: [email protected]
    echo Subject: mov files greater than 1M
    echo
    find /path/to/folder/ -type f -size +1M -name "*.mov"
} | ssmtp [email protected]

You don't need the printf on find.

1
  • Awesome that works really well. The only reason I had the -printf "%f\n" was to trim of the full path and just have the filenames. Thank you very much that was really helpful.
    – Bas
    Commented Nov 20, 2015 at 11:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .