#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2004
    Posts
    2
    Rep Power
    0

    How to find a file and email it.


    Hi Folks,

    I need to be able to find a file x and email it to a user via a script.

    The file could exist in 2 places, both of these places are under the directory $APPLCSF (/p01/out) ie. it could be in /p01/out/dir1 or /p01/out/dir2

    So I guess I need to do something like

    cd $APPLCSF
    find . -name filex -print

    This will come back with the filename and place, but how do I use this result ?

    I need to then

    uuencode filex | mail -s "..." auser@blah

    Thanks for any help provided.
    Dave
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jul 2004
    Location
    Middle Europa
    Posts
    1,198
    Rep Power
    17
    for filex in `find . -name filex`
    do uuencode $filex | mail -s "..." auser@blah
    done
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2004
    Posts
    2
    Rep Power
    0
    thanks.
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2004
    Posts
    1
    Rep Power
    0
    Wouldn't this work as well?

    cd $APPLCSF
    find . -name filex -maxdepth 3 -exec sh -c 'uuencode ${0} | mail -s "..." auser@blah' {} \;

    I apologize if I am completely wrong and this command works differently in Unix than in Linux, as I am used to.

IMN logo majestic logo threadwatch logo seochat tools logo