UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now!
  #1  
Old December 20th, 2004, 04:50 PM
davebwithane davebwithane is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 2 davebwithane User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 52 sec
Reputation 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

Reply With Quote
  #2  
Old December 21st, 2004, 02:44 AM
guggach guggach is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2004
Location: Middle Europa
Posts: 1,083 guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 19 h 49 m 57 sec
Reputation Power: 9
for filex in `find . -name filex`
do uuencode $filex | mail -s "..." auser@blah
done

Reply With Quote
  #3  
Old December 22nd, 2004, 08:23 PM
davebwithane davebwithane is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 2 davebwithane User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 52 sec
Reputation Power: 0
thanks.

Reply With Quote
  #4  
Old December 24th, 2004, 02:16 AM
omarserenity omarserenity is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 1 omarserenity User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation 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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > How to find a file and email it.


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

IBM developerWorks




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway