moving files based on condition


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers moving files based on condition
# 8  
Old 02-29-2012
You have to tell us more about the criterias :
How do we know to which developer which bad file should be sent ?

Should the name of the developer be extracted from the absolute name of the bad entry ?

If so could you please provide an example of the content of /home/mydir/badfile.txt ?

Otherwise, please clarify

Last edited by ctsgnb; 02-29-2012 at 06:30 PM..
# 9  
Old 02-29-2012
we are not extracting the name from any where. e.g i will put my email. in badfile.txt it shows only the file name not the actual data file. we are not moving the file from BASE DIR. but in the current requirment we have to attached the actual files which shows by badfile to the email. the files we can find in the BASE DIR. the code i have is checks the comma delimeter of the columns. if its find there comma missing puts the file name in the badfile.txt and if its not put the file name inthe goodfile.txt.
# 10  
Old 02-29-2012
Do you have an example of content of badfile.txt ?

---------- Post updated at 07:38 PM ---------- Previous update was at 07:35 PM ----------

Are you willing to send badfile.txt to your mail ? inline or in attachement ?

OR

Are you willing to send all the files that are listed in badfile.txt to your mail ? inline or in attachement ?
# 11  
Old 02-29-2012
$cat badfile.txt
column_testingerror.csv
test_data_validation.csv
Cal_test.csv

this is just a list of files. i need to send all the files as a attachment. thanks
# 12  
Old 02-29-2012
Code:
(       echo "To: username@host"
        echo "From: otheruser@host"
        echo "Subject: subject"
        echo
        while read LINE
        do
                sed 's/$/\r/' "$LINE" | uuencode "$LINE"
        done < badfiles.txt )  | sendmail ...

# 13  
Old 03-01-2012
I don't mean to be a stick in the mud but mutt does have a "-a" option for specifying file attachments.

Quote:
echo Please see Attached | mutt -s "Disregard all previous talk of Owls. All is as it seems. Hoot-Hoot" root@localhost -a archive.tar
uuencode isn't universally supported so sending MIME attachments is probably for the best unless you're operating under some kind of constraint.
# 14  
Old 03-01-2012
mutt is an interactive mailer however; there may not always be a human there to push the keys. It can be coerced into behaving automatically but only under great duress.

some versions of uuencode support the -m option, to encode in base64 instead.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Moving old files based on pattern

Hi all I am trying to loop through a directory of files using a given search pattern. some of the files will be duplicated due to the pattern, but of the duplicate files i wanted to move the older files to another location. Is there any straightforward way of doing this ? One of ways I... (1 Reply)
Discussion started by: sthapa
1 Replies

2. Shell Programming and Scripting

Moving files based on file name

Hi All, I have multiple files in the folder, I want to move those files into the other folder on based of name File names: Template_server1_01==> Template_server1_02==>To one directory /Server1 Template_server1_03==> Template_server2_01==> Template_server2_02==>To one... (9 Replies)
Discussion started by: sharsour
9 Replies

3. Shell Programming and Scripting

Moving files based on size (string to integer)

I have a log file that I want to archive out as it reaches 100MB. I am using the following to get the file size into a variable but get the error "line 5: filesize=$(wc -c < logfile.log) if then echo "is greater than 100M" else echo "is less than 100M" fi I'm sure there's something... (2 Replies)
Discussion started by: Flakman
2 Replies

4. Shell Programming and Scripting

Moving files based on file creation

Hi, I have a directory having so many number of files. Now I want to move the files which are older than one month (lets say) from this directory to another directory (say BKP dir). Simply, if file is olderthan one month move it from source1 dir to BKP1 dir. My file names doesn't have... (7 Replies)
Discussion started by: karumudi7
7 Replies

5. UNIX for Dummies Questions & Answers

Script moving files based on date

Hi, I need a script that moves files based on date to a folder. The folder should be created based on file date. Example is : Date file name ----- -------- Oct 08 07:39 10112012_073952.xls Oct 09 07:39 10112012_073952.xls Oct 10 07:39 ... (6 Replies)
Discussion started by: rockingvj
6 Replies

6. UNIX for Advanced & Expert Users

Moving multiple files based on the pattern

I want to search for a particular file name patterns and move them to a specific folder, is it possible to do it with awk or sed? (1 Reply)
Discussion started by: rudoraj
1 Replies

7. Shell Programming and Scripting

How to compare 2 files & get only few columns based on a condition related to both files?

Hiiiii friends I have 2 files which contains huge data & few lines of it are as shown below File1: b.dat(which has 21 columns) SSR 1976 8 12 13 10 44.00 39.0700 70.7800 7.0 0 0.00 0 2.78 0.00 0.00 0 0.00 2.78 0 NULL ISC 1976 8 12 22 32 37.39 36.2942 70.7338... (6 Replies)
Discussion started by: reva
6 Replies

8. Shell Programming and Scripting

Moving the files based on count and time.

Hi, I have a requirement ,let us say 1000 files needs to be transferred in an hour from one path to another path and if the files (1000 files) are transferred within an hour ( say 40 mins), then the process should remain idle for the remaining time ( 20 mins). (3 Replies)
Discussion started by: Asaikarthik
3 Replies

9. Shell Programming and Scripting

Moving file to directory based on condition.

Can any one help me to correct following script. I have 2 directories DropZone and ProcessZone. File pattern is *VEHDESCSUM*. Finding the 'no of files' in DropZone directory using ls *VEHDESCSUM* |wc -l If DropZone has more than one file or 0 files then exit 1 If DropZone has one file then... (2 Replies)
Discussion started by: ramanagh
2 Replies

10. UNIX for Dummies Questions & Answers

Moving files based on creation date

Howdy, I'm trying to figure out how to move multiple files based on their creation date. If anyone can enlighten me it would be most appreciated!! Thanks! :D (1 Reply)
Discussion started by: dgoyea
1 Replies
Login or Register to Ask a Question