Sponsored Content
Full Discussion: Find modify and delete files
Top Forums Shell Programming and Scripting Find modify and delete files Post 302863551 by nimafire on Monday 14th of October 2013 02:42:31 PM
Old 10-14-2013
hey. i have edit this script to check only .php and .pl file is it correct ?

Code:
#!/bin/bash
EMAIL=Mymail@yahoo.com
START="a.txt"
END="b.txt"
DIFF="c.txt"
mv ${START} ${END} #moving the first file to be compared
find /home -name "\*.php|\*.pl" -type f -mmin -5 -print > ${START}
diff ${START} ${END} | grep '<' > ${DIFF}
COUNT=$(cat ${DIFF} | wc -l)
if [[ -s ${DIFF} ]] ; then
cat -- ${DIFF} | mail -s "Modified files in last 5 minutes *** ${COUNT} ***" $EMAIL
fi

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

batch delete using find, files with # character

UPDATE: Sorry, disregard this. It did work, I made a mistake; I just shouldn't have been using maxdepth. I do think it is good to know, however, that find | grep '#' | xargs rm will "clean up" funnily named files in a directory. Of course, some of those funnily named files are there... (0 Replies)
Discussion started by: tphyahoo
0 Replies

2. Shell Programming and Scripting

Find files including subdirectory and Delete

Hello Experts, I m newbie. Could u pls help me to write script on Sun solaris- I have backup directory "/var/opt/backup/" where files are backed up in different directory "backup1" "backup2" "backup3". I want to write a shell script which i will put in crontab and daily midnight it will... (1 Reply)
Discussion started by: thepurple
1 Replies

3. UNIX for Dummies Questions & Answers

find and delete files

hi all , i want to find and interactively delete all the files having size greater than 20 bytes using "find" and other commands..... (8 Replies)
Discussion started by: sonu_pal
8 Replies

4. Shell Programming and Scripting

find files for a particular date and delete

How can I delete files for a particular date ? I apologize in advance If there is solution please put the link. Thanks, (5 Replies)
Discussion started by: jville
5 Replies

5. Shell Programming and Scripting

Script to find files and delete it by comparing

I have a directory where lot of "gzip" files are dropped in every 5 minutes. There is an application which will process these gzip and move it to another directory but will leave a gzip.out file with lot of output data. I need to remove all the outfiles except for the one which is being... (1 Reply)
Discussion started by: gubbu
1 Replies

6. Homework & Coursework Questions

Find and delete empty files and directories

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Need to make a script, to remove all empty files and folders from current category. It also should show the name... (2 Replies)
Discussion started by: Itixop
2 Replies

7. UNIX for Dummies Questions & Answers

Script to find the files and delete them

This is a real world problem so I think you might found this interesting. We have servers which are shared by multiple team members. Each team member has its own user id and home directory. Now with time each user starts creating files which in end caused the disk to be full. Now for creating a... (5 Replies)
Discussion started by: Rohit06
5 Replies

8. Shell Programming and Scripting

Script to go Into Directories and Find/Delete files

I have a task, I usually do manually, but with growing responsibilities I tend to forget to do this weekly, I want to write a script that automates this, but I cant seem to work it out in my head, I have the shell of it out, but need help, and you guys have helped me with EVERY problem I have... (5 Replies)
Discussion started by: gkelly1117
5 Replies

9. UNIX for Dummies Questions & Answers

Find command to delete old files

Hi, I want to delete all the log files that was created on year 2008. My command is not working. Any idea? find . -name '*.log' -mtime 1460 -exec ls -lt {} \; Thank you. (2 Replies)
Discussion started by: samnyc
2 Replies

10. Shell Programming and Scripting

Find command to delete the files

Hi All, I've created 2 files touch -t 201309101234 aa10 touch -t 201309111234 aa11 Exact 60 days before from today date is SEPT 12th . As per the following command as i gave +60 means the files which were created before sept12th should be deleted find /etc/logs/*aa* -type f -atime +60... (5 Replies)
Discussion started by: smile689
5 Replies
IO::InnerFile(3)					User Contributed Perl Documentation					  IO::InnerFile(3)

NAME
IO::InnerFile - define a file inside another file SYNOPSIS
### Read a subset of a file: $inner = IO::InnerFile->new($fh, $start, $length); while (<$inner>) { ... } DESCRIPTION
If you have a filehandle that can seek() and tell(), then you can open an IO::InnerFile on a range of the underlying file. PUBLIC INTERFACE
new FILEHANDLE, [START, [LENGTH]] Class method, constructor. Create a new inner-file opened on the given FILEHANDLE, from bytes START to START+LENGTH. Both START and LENGTH default to 0; negative values are silently coerced to zero. Note that FILEHANDLE must be able to seek() and tell(), in addition to whatever other methods you may desire for reading it. set_length LENGTH get_length add_length NBYTES Instance methods. Get/set the virtual length of the inner file. set_start START get_start add_start NBYTES Instance methods. Get/set the virtual start position of the inner file. binmode close flush getc getline print LIST printf LIST read BUF, NBYTES readline seek OFFFSET, WHENCE tell write ARGS... Instance methods. Standard filehandle methods. VERSION
$Id: InnerFile.pm,v 1.4 2005/02/10 21:21:53 dfs Exp $ AUTHOR
Original version by Doru Petrescu (pdoru@kappa.ro). Documentation and by Eryq (eryq@zeegee.com). Currently maintained by David F. Skoll (dfs@roaringpenguin.com). perl v5.18.2 2005-02-10 IO::InnerFile(3)
All times are GMT -4. The time now is 05:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy