Remove files send through mail


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Remove files send through mail
# 1  
Old 12-14-2017
Remove files send through mail

I wan't to remove last 5 and 10 days files from two directory and send the remove files list in mail

Output send through mail

Code:
find /kalia/cd/ -type f -mtime +5 exec rm {} \;
find /kalia/uk/ -type f -mtome +10 exec rm {} \;

Output send through mail


File has been deleted
Code:
/kalia/cd/a.txt
/kalia/cd/b.txt
/kalia/cd/c.txt
/kalia/uk/g.txt
/kalia/uk/p.txt
/kalia/uk/n.txt

# 2  
Old 12-14-2017
Any attempts / ideas / thoughts from your side?
Did you consider that find allows for multiple actions, i.e. printing file names along with deleting the respective files?
And, does your find version (which you fail to mention, btw) allow for the -delete action?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Client was not authenticated to send anonymous mail during MAIL FROM (in reply to MAIL FROM comm

I am having trouble getting mail to work on a red hat server. At first I was getting this message. Diagnostic-Code: X-Postfix; delivery temporarily suspended: connect to :25: Connection refused Then added the port to my firewall. Then I temporarily turned off selinux. I then copied this file... (1 Reply)
Discussion started by: cokedude
1 Replies

2. Shell Programming and Scripting

Script for checking files for last hour and send a mail

Hello, I need to write a script to check the files in one folder , if that folder doesn't have files generated from last 1 hr then we need to send mail to particular persons. So Can you please help me to write script to check the files and send email. Thank you.. (1 Reply)
Discussion started by: archana23
1 Replies

3. UNIX for Advanced & Expert Users

Zip the files if count is more than 0 and send a mail

All, I am new to shell scripting and trying to get the count of files that starts with error and with extension .out, if the count is greater than 0 and zip the file and send an email with the content of error.out file, here is my script cd /temp testcount =$('find . -name '*.out' -print |... (4 Replies)
Discussion started by: luckydoll
4 Replies

4. Shell Programming and Scripting

want to send 4 files output in one mail

Hi All , i have a wrapper HTML script -FS_CHECK_HTML_SCIPT_WT_Statusbar.sh which read a TXT file (script_KB.txt) and sends output to a mail in tabular format. TXT file is having 6 columns and so wrapper script create a table with 6 columns and supplies those 6 columns data from TXT file .... (2 Replies)
Discussion started by: deepakiniimt
2 Replies

5. UNIX for Advanced & Expert Users

need to configure mail setting to send mail to outlook mail server

i have sun machines having solaris 9 & 10 OS . Now i need to send mail from the machines to my outlook account . I have the ip adress of OUTLOOK mail server. Now what are the setting i need to do in solaris machines so that i can use mailx or sendmail. actually i am trying to automate the high... (2 Replies)
Discussion started by: amitranjansahu
2 Replies

6. Shell Programming and Scripting

How to send mail with multiple files attached?

Hi, I would like to send a mail with multiples files attached. Until now i was doing a "find" and then a "tar" of the text files. As I need to be able to read them on a mobile device such as Blackberry for instance, i would like to send them in one single mail, but without taring them. is... (2 Replies)
Discussion started by: Pierrito
2 Replies

7. AIX

Send mail with attachment having csv files

Hi, Could anyone please help me to send multiple files of .csv format in one mail. Thanks Aj (2 Replies)
Discussion started by: atinjain05
2 Replies

8. UNIX for Advanced & Expert Users

send all mail to files instead of relaying out

I had a wierd request from one of our guys. We are running on RedHat EL5. He asked that all mail originating from 3 servers he owns be sent to files instead of being sent out. My first thought is to set "Smart" relay host in sendmail.cf on each of the 3 servers so all messages are sent to a 4th... (0 Replies)
Discussion started by: mglenney
0 Replies

9. Shell Programming and Scripting

Script needed which will send a mail with attachment files

Hello, I need a shell script which need to send a mail with 4 *.csv files as attachments.Anybody can help me? At present i have a script which is sending only one file as attachments.But i need a script which send 4 files in a shot. #!/bin/ksh /bin/mail xxxx@xx.xom << EOF Subject:... (4 Replies)
Discussion started by: Mar1006
4 Replies

10. Shell Programming and Scripting

find files older than 30mins,count and send mail

Hi all, I wrote this script to find files older than time parameter, count the number of files, and send an email to me that some files are in a particular folder. For the particular path, the script should wait delay parameter before running again. For example, assuming the input file looks... (4 Replies)
Discussion started by: kayarsenal
4 Replies
Login or Register to Ask a Question