Find files in a directory which are older than 2 hrs


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Find files in a directory which are older than 2 hrs
# 1  
Old 03-21-2009
Find files in a directory which are older than 2 hrs

hi all,

I need to find files in a directory which are older than N hrs...
n can be 1,2,3,.. etc
when tried using -mtime option it gives all the files in the last 24hrs from the current time .

please help me out on this ..

thanks
# 2  
Old 03-21-2009
you can specify in minute .here i have specified for 1 hr / 60 mins

find /mydirectory/ -mmin +60
# 3  
Old 03-21-2009
when i tried executing the command it is returning an error saying "bad option" Smilie
find: bad option -mmin
# 4  
Old 03-21-2009
which unix ur using?

u can try amin instead of mmin , or try cmin
# 5  
Old 03-21-2009
am using SUNOS 5.8
still i did not get any result...
# 6  
Old 03-21-2009
find $PATH -type f -mmin +60
# 7  
Old 03-21-2009
still the same ..error
i think my OS does not support this option
when i checked in man of Find command i do not find this option anywhere...
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 if create time of last created file in a directory is older than 5 minutes

A process xyz is running and creating file1, file2, file3, .... filen. how do i know if the process has stopped and createtime of the last file (filen) is older than 5 minutes? OS is AIX (3 Replies)
Discussion started by: malaika
3 Replies

2. Shell Programming and Scripting

Deleting files and directory's older than 3 months

I have a qnap TS259 that is running ubuntu. Have successfully setup back scripts that are initiated by cron. I would like to create a couple scrypts that would operate on the recycle bins for both drives. Just want to be able to run the script manually that would walk through both directories... (13 Replies)
Discussion started by: mackconsult
13 Replies

3. Shell Programming and Scripting

Delete files older than 10 Days in a directory

Hi All I want to remove the files with name like data*.csv from the directory older than 10 days. If there is no files exists to remove older than 10 days, It should not do anything. Thanks Jo (9 Replies)
Discussion started by: rajeshjohney
9 Replies

4. Shell Programming and Scripting

To delete files older than 24 hrs

I have to retain only 1 day files in my system an I have to delete all the other files which are older than 24 hrs. Please let me know the option I have to give in the find -mtime command. (3 Replies)
Discussion started by: rajesh8s
3 Replies

5. Shell Programming and Scripting

List last 10 Hrs file and find error files

Hi, I need a script that can search a word "Error" in last 10 Hrs generated logs in /log/App1 and /log/App2 folder.. Note these directories have massive log files ...actually our application generate 100 Log files of size 2MB in just a min so script must be fast enough to cater this I... (9 Replies)
Discussion started by: Mujtaba khan
9 Replies

6. Shell Programming and Scripting

Delete the files older than 3 weeks in a particular directory.

Hi, Friends, I am writing a script to delete all the files which are there for more than 3 weeks. I have tried this : find /home/appl/backup -type f -mtime +21 -exec rm -f {} \; But i am not sure if it deletes only the files in specified directory or all the directorinies in the provieded... (3 Replies)
Discussion started by: rajsharma
3 Replies

7. Shell Programming and Scripting

Removing files older than one week in a directory

Hi, I need a shell script to remove the files older than a week in a directoy and if necessary to zip the files. (2 Replies)
Discussion started by: sudhakaryadav
2 Replies

8. Shell Programming and Scripting

unix command/s to find files older than 2 hours in a directory

I need to write a script to find files older than 2 hours in set of direcotries and list them ina mail. I know find command ti list files greater/lesser than days but i need to do it for hours. Any input. (6 Replies)
Discussion started by: Presanna
6 Replies

9. Shell Programming and Scripting

Find files older than 20 days & not use find

I need to find files that have the ending of .out and that are older than 20 days. However, I cannot use find as I do not want to search in the directories that are underneath the directory that I am searching in. How can this be done?? Find returns files that I do not want. (2 Replies)
Discussion started by: halo98
2 Replies

10. Shell Programming and Scripting

RE:backup files older then 24hrs to a new directory .

How do you move (mv) files to a backup directory from a particular directory when the files are older the 24hrs copied from a batch script run every 24 hrs. Would you use find or some kind of timestamp.timestamp="$(date +'%m%d%I%M')" (2 Replies)
Discussion started by: amceyeson
2 Replies
Login or Register to Ask a Question