Results 1 to 5 of 5

Thread: send a random image via email

  1. #1
    Join Date
    Oct 2008
    Location
    /usr/bin/
    Beans
    442
    Distro
    Ubuntu

    send a random image via email

    How can I send a random image from a folder and any of its subfolders

    the name of the file could be anything.jpg

    something like the following but to take a random image from /images/folder and any of the subfolders

    mutt -s "image of the day" my@mail.com -a /images/image1.jpg < mailmessage.txt

    thanks

  2. #2
    Join Date
    Jul 2007
    Location
    Poland
    Beans
    4,403
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: send a random image via email

    maybe something like

    Code:
    mutt -s "image of the day" my@mail.com -a "$( find /images -type f | sort -R | head -1 )" < mailmessage.txt
    if your question is answered, mark the thread as [SOLVED]. Thx.
    To post code or command output, use [code] tags.
    Check your bash script here // BashFAQ // BashPitfalls

  3. #3
    Join Date
    Oct 2008
    Location
    /usr/bin/
    Beans
    442
    Distro
    Ubuntu

    Re: send a random image via email

    Quote Originally Posted by Vaphell View Post
    maybe something like

    Code:
    mutt -s "image of the day" my@mail.com -a "$( find /images -type f | sort -R | head -1 )" < mailmessage.txt
    perfect, but if other file types exist I dont want to include those, only images .jpg or JPG

    thanks
    Last edited by sohlinux; October 15th, 2012 at 01:09 PM.

  4. #4
    Join Date
    Jul 2007
    Location
    Poland
    Beans
    4,403
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: send a random image via email

    find /images -iname '*.jpg' -type f
    if your question is answered, mark the thread as [SOLVED]. Thx.
    To post code or command output, use [code] tags.
    Check your bash script here // BashFAQ // BashPitfalls

  5. #5
    Join Date
    Oct 2008
    Location
    /usr/bin/
    Beans
    442
    Distro
    Ubuntu

    Re: send a random image via email

    Quote Originally Posted by Vaphell View Post
    find /images -iname '*.jpg' -type f
    thanks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •