find files onder than 15 minutes


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users find files onder than 15 minutes
# 1  
Old 08-05-2005
Power find files onder than 15 minutes

Hi Friends,

i have to write a script to raise a flag if there are any files that are older than 15 minutes in the directory.The directory is supplied as the parameter to the script.
please help with a sample script.

Thanks in advance
veera
# 2  
Old 08-05-2005
Please read the rules:
(4) Do not 'bump up' questions if they are not answered promptly. No duplicate or cross-posting and do not report a post where your goal is to get an answer more quickly.

I have closed the duplicate thread.
# 3  
Old 08-09-2005
This is cheesy, but meets the requirements (the right way would be to touch the file back 15 minutes)

Code:
#!/bin/bash

RCPT="username@domain.zzz" # This is who to mail the list to

touch /tmp/.adkojha

if [ "$1" = "" ]
   then echo "Usage: $0 /path/to/dir"
          exit 1
fi
cd $1

sleep 900
find . -newer /tmp/.adkojha | mail $RCPT
rm -f /tmp/.adkojha

Sorry it has been a long day
# 4  
Old 08-10-2005
Quote:
Originally Posted by 98_1LE
This is cheesy, but meets the requirements (the right way would be to touch the file back 15 minutes)

Code:
#!/bin/bash

RCPT="username@domain.zzz" # This is who to mail the list to

touch /tmp/.adkojha

if [ "$1" = "" ]
   then echo "Usage: $0 /path/to/dir"
          exit 1
fi
cd $1

sleep 900
find . -newer /tmp/.adkojha | mail $RCPT
rm -f /tmp/.adkojha

Sorry it has been a long day

A question. Why use a touch and then a rm.

find has -amin and -mmin option. That can be used as well.

Is there any reason as such, that these do not serve the purpose ?

Vino
# 5  
Old 08-10-2005
Computer files older than 15 minutes

Hi Friends,

Thanks a lot for your response.yes i can always use find with amin and mmin.

And the reply given by 98 1 LE is also helpful.
Once again thank you friends
Bye
veera
# 6  
Old 08-10-2005
Quote:
Originally Posted by vino
A question. Why use a touch and then a rm.

find has -amin and -mmin option. That can be used as well.

Is there any reason as such, that these do not serve the purpose ?

Vino
vino, amin and mmin are not standard. GNU added them to their version of find which Linux uses. They will not work with the standard find command.
# 7  
Old 08-10-2005
Perderabo,
Thanks much.

vino
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Find file that are accessed less than 10 minutes in a directory

Hi All,, I need to find the latest files that are accessed less than 10mins in a particular directory & send those files in an attachment. I could use the below simple one. But if the directory was not updated any recently i could mail the old file again, i need to eliminate that.. What shld... (8 Replies)
Discussion started by: Jeevitha
8 Replies

2. Shell Programming and Scripting

Find the Pid and Kill the Process after a Few Minutes

hi guys i had written a shell script Display Information of all the File Systems i want to find the pid and kill the process after few minutes.how can i obtain the pid and kill it??? sample.sh df -a >> /tmp/size.log and my cron to execute every minute every hour every day * *... (5 Replies)
Discussion started by: azherkn3
5 Replies

3. Shell Programming and Scripting

Find out whether directory has been updated with files in the last 5 minutes or not

Hi, I am trying to work on this script that needs to monitor a Directory. In case there are no files received in that Directory for the last 5 minutes, it has to send out an alert. Could someone please suggest any approach for the same. Note: I did check out various previous psts -... (8 Replies)
Discussion started by: rituparna_gupta
8 Replies

4. UNIX for Advanced & Expert Users

find files modified by hours instead of minutes

Is there an easy way to find files modified by hours? If you wanted to find something modified by like 28 hours then I know you could do this: find . -mmin -1440It is pain to break out a calculator and calculate in minutes. Could you do something similar to this? I know I don't have the right... (1 Reply)
Discussion started by: cokedude
1 Replies

5. Shell Programming and Scripting

find files created within 30 minutes

find . -name *.txt -mmin -30 This is working in Redhat but not in Solaris.. What is the equivalent option in Solaris? (1 Reply)
Discussion started by: tene
1 Replies

6. Shell Programming and Scripting

how to find the time before 30 minutes

Hi All, I want to find out the time before 30 minutes. I am able to do with in hours limit. date Fri Aug 21 06:50:00 BST 2009 TZ=CST+1 date Fri Aug 21 04:50:02 CST 2009 Can any one please help me (6 Replies)
Discussion started by: vikash_k
6 Replies

7. Shell Programming and Scripting

Find files which are <n> minutes old

Hi, i want to find certain files which are more than <n> minutes old,i have the command to find the files say <n> days old(as below) but not in terms of minutes. find . -name "14*.000" -type f -mtime +1 Is there any way to find this? Regards, Cherry (3 Replies)
Discussion started by: cherryven75
3 Replies

8. Shell Programming and Scripting

Find the age of a file in Minutes

KSH: Please lt me know how to find the age of a file in minutes(Based on last modified time). ie, if the file was modified 15 Minutes ago, the output should be 15 (1 Reply)
Discussion started by: hari_anj
1 Replies

9. Shell Programming and Scripting

Find files on minutes basis

Hello, I was trying to find files which are created in last five minutes . I tried to use command find with ntime and mtime but was not successfull then i read from this forum that we can not have a find option on minutes or seconds or hours...... Can somebody Pls expalin how can i search... (3 Replies)
Discussion started by: er_aparna
3 Replies

10. Shell Programming and Scripting

only find files older than x minutes old

I am looking for a way to show files that have been created within a certain period (say anything older than 10 minutes or so). Is there a command/series of commands I can do this with? As an example, I have the following in a directory: -rw-r--r-- 1 owner group 70175 May 16 09:10... (1 Reply)
Discussion started by: dsimpg1
1 Replies
Login or Register to Ask a Question