Script to find and email selected files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script to find and email selected files
# 1  
Old 02-16-2011
Script to find and email selected files

I am trying to come up with a script that will search for selected files and then email them to me.

For example, say I have a directory that has the following files:
Code:
AA_doug.txt
AA_andy.txt
BB_john.txt
APPLE_mike.txt
GLOBE_ed.txt
GLOBE_tony.txt
TOTAL_carl.txt


what is the best way to find the following files and email them to myself? I think I have found a way to do it with the find command but I am not sure as I am still learning as I go.

email would send:
Code:
AA_doug.txt
AA_andy.txt
GLOBE_ed.txt
GLOBE_tony.txt
TOTAL_carl.txt

Any help or suggestions to get me started would be appreciated.

Last edited by Franklin52; 02-17-2011 at 03:57 AM.. Reason: Please use code tags
# 2  
Old 02-16-2011
you need send these files by attach in mail, or just send the file name to mail?
# 3  
Old 02-16-2011
I would like to send them as an attachment if possible
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find key pattern and print selected lines for each record

Hi, I need help on a complicated file that I am working on. I wanted to extract important info from a very huge file. It is space delimited file. I have hundred thousands of records in this file. An example content of the inputfile as below:- ## ID Ser402 Old; 23... (2 Replies)
Discussion started by: redse171
2 Replies

2. SCO

Using FIND but ignoring selected folders

This may be ludicrously easy to most people, but I've been scratching my head today trying to do it. I'm archiving data on a OpenServer 5.0.6a box using a combination of FIND, CPIO and BZIP2. What I'd like to do is archive a range of folders, but ignore some. For instance, if I have 5... (1 Reply)
Discussion started by: mmcardle
1 Replies

3. Shell Programming and Scripting

Script to find string & email

Hi I have a query that some of you may be able to help me with if poss? I'd appreciate it very much. I've got a few log files, that I would like to search for a string. When the string is found, i'd then like to email out the line/sting. If not found, i'd like to email out 'no found'... (2 Replies)
Discussion started by: horhif
2 Replies

4. Shell Programming and Scripting

trying to print selected fields of selected lines by AWK

I am trying to print 1st, 2nd, 13th and 14th fields of a file of line numbers from 29 to 10029. I dont know how to put this in one code. Currently I am removing the selected lines by awk 'NR==29,NR==10029' File1 > File2 and then doing awk '{print $1, $2, $13, $14}' File2 > File3 Can... (3 Replies)
Discussion started by: ananyob
3 Replies

5. Shell Programming and Scripting

Need to find occurrences of email domains in all files in a directory

Hello Everyone! I trust you are off to a great week! Trying to output the name and count of each uniquely occurring domain in the current directory for a portion of a script I'm building. Here's what I'm stuck on: - Need to find UNIQUE occurences of domains (*@domain.com) in ALL files in... (4 Replies)
Discussion started by: linuxhombre
4 Replies

6. UNIX for Dummies Questions & Answers

Find & Copy Selected files to another Directory

I am wanting to find files within a directory that are over a certain number of days old and copy them to another directory. And unfortunately not having much luck.......is someone able to help. Would also like to add that there are literally thousands of files that I am wanting to copy in one... (3 Replies)
Discussion started by: hellfyre
3 Replies

7. Shell Programming and Scripting

Script to place selected columns from a group of files side by side in a new file

Hi Everyone, I need a shell/perl script to bring selected columns from all the files located in a directory and place them in a new file side by side. File1: a b c d 2 3 4 5 f g h i .......... File2: I II III IV w x y z .............. and so on many files are there...... (8 Replies)
Discussion started by: ks_reddy
8 Replies

8. Shell Programming and Scripting

Running a command on multiple selected files in nautilus script

I am trying to make a script to convert drg files to wav and so far i have this #!/bin/bash drg2sbg "$*" -o "$*".sbg sbagen -Wo "/home/nick/Desktop/I-Doser Wave Files/"$*"" "$*".sbg rm "$*".sbg cd "/home/nick/Desktop/I-Doser Wave Files" rename 's/\.drg$/\.wav/' *.drg exit the drg2sbg and... (2 Replies)
Discussion started by: Nickbowlingdude
2 Replies

9. Shell Programming and Scripting

Script to find, grep and email

running a suse linux 10. I'm trying to write a script that searches for a file with certain name and that has been modified less than 30 minutes ago, then search for a certain string in that file and email this string out. I have tried different combinations of find, grep and email but no luck... (7 Replies)
Discussion started by: basisvasis
7 Replies

10. Shell Programming and Scripting

remove files other than selected

I wanna remove a set files other than some selected files. Eg. :rolleyes::rolleyes::rolleyes: a directory contains n files like test1.dat test2.dat test3.dat test4.dat out5.dat out1.dat i wanna remove all files which doesnot name like *test* I want to use this in shell... (22 Replies)
Discussion started by: freakygs
22 Replies
Login or Register to Ask a Question