Find age of files...


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Find age of files...
# 1  
Old 10-02-2009
Find age of files...

I am trying to figure out how to look at only the following directory...
/lcl/prd/data/dc003p/dump

And search it for any files that have a .arc extension and are older then 24 hours.

I have never done anything like this and have no idea where to start. I want to make sure it does not drill into subdirectories at all.

Could anyone show me how I might do this?

Thank you.
# 2  
Old 10-02-2009

Assuming that there are no directories ending in .arc:

Code:
find /lcl/prd/data/dc003p/dump/*.arc -mtime +1

# 3  
Old 10-02-2009
Thanks!
# 4  
Old 10-05-2009
Hhhhmmm still not exactly what I am looking for in the results.

Last edited by LRoberts; 10-05-2009 at 08:55 AM..
# 5  
Old 10-05-2009
Quote:
Originally Posted by LRoberts
That command works on Solaris however it seems to get mixed results on Linux. For example I did the following...

find /lcl/apps/Tivoli/omnibus_procedure_scripts *.sh -mtime +1

And the results were...

/lcl/apps/Tivoli/omnibus_procedure_scripts
/lcl/apps/Tivoli/omnibus_procedure_scripts/Mon_DBA_F.sh
/lcl/apps/Tivoli/omnibus_procedure_scripts/cache.dat
Mon_DBA_F.sh

Instead of listing only .sh files it resulted in others such as .dat.

---------- Post updated at 03:32 AM ---------- Previous update was at 03:20 AM ----------

Ok cancel that I see what its doing now....
Its listing all the files but at then end is the one that matches.

Anyway to have it not list like that?

It still seems to be messing with what I am trying to capture which is the count...

ringneck:/lcl/apps/Tivoli/omnibus_procedure_scripts>find /lcl/apps/Tivoli/omnibus_procedure_scripts *.sh -mtime +1
/lcl/apps/Tivoli/omnibus_procedure_scripts
/lcl/apps/Tivoli/omnibus_procedure_scripts/Mon_DBA_F.sh
/lcl/apps/Tivoli/omnibus_procedure_scripts/cache.dat
Mon_DBA_F.sh
ringneck:/lcl/apps/Tivoli/omnibus_procedure_scripts>find /lcl/apps/Tivoli/omnibus_procedure_scripts *.sh -mtime +1 | wc -l
4

As you can see it shows that it finds Mon_DBA_F.sh because its file ext is .sh however the count is counting everything so it has the result of 4

I need to only count the files that have the ext .sh.

Any ideas? Thanks!

put the extra code in below

Code:
find /lcl/apps/Tivoli/omnibus_procedure_scripts *.sh -mtime +1  2>/dev/null

BR
# 6  
Old 10-05-2009
I tried that but I get the same results....
What exactly does that do?
# 7  
Old 10-05-2009
Quote:
Originally Posted by LRoberts
I tried that but I get the same results....
What exactly does that do?
Code:
kindly eliminate the space in bold below and put "/" instead...
find /lcl/apps/Tivoli/omnibus_procedure_scripts/*.sh -mtime +1 2>/dev/null


the usage of 2>/dev/null is to redirect the error to /dev/null.

is "omnibus_procedure_scripts" a file or directory name?

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Age of file

Hi All.. Is there any easy way to find out how many days older is file? for ex. fileA 20 days fileB 10 days I am currently on AIX, and there is no STAT command available in this environment. What are my options? Thanks Abhijeet R (1 Reply)
Discussion started by: freakabhi
1 Replies

2. AIX

Visual Age C++

hi , After i installed the visual age c++ its got installed but am not able to find the bin directory in the /usr/vacpp.am i need to install the some fileset ???? please help me.version is 7 mak (1 Reply)
Discussion started by: senmak
1 Replies

3. Shell Programming and Scripting

Perl Find file age

Hi I can not say that i am new to perl but today i learned something new, i wanted to know age (last time file got modified) of file so i initially thought of using find -mtime command but when i googled it, i found perl solution for the same my $age = -M $ARGV ; print "$ARGV age is... (1 Reply)
Discussion started by: zedex
1 Replies

4. Shell Programming and Scripting

file age

How can I count the age of the file (e.g. in minutes)? (4 Replies)
Discussion started by: jarmo.leppanen
4 Replies

5. 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

6. What is on Your Mind?

What is your age? (Part 2)

What is your age? poses an interesting question, but the age categories had some room for improvement. So I thought that I would start a new poll with with a better distribution of age groups. As with the other poll, this is a public poll. People can click on the numbers to see who voted and... (37 Replies)
Discussion started by: Perderabo
37 Replies

7. What is on Your Mind?

What is your age?

What is your age? (15 Replies)
Discussion started by: royal
15 Replies

8. UNIX for Dummies Questions & Answers

find a process age

I can write a script to use ps and interigate the output, but is there a command that works similar to the find command for files where I can request a list of all the running processes over 1 day old ? thanks! (8 Replies)
Discussion started by: MizzGail
8 Replies

9. UNIX for Dummies Questions & Answers

How to find the File Age and wait for that...

Hi, I want to know my file is 1 hr 30 min old or not, If 1 hr 30 min old I will do some tasks in that file.. other wise I will wait to 1 hr 30 min and then do the tasks.. how to do it in Unix script? any idea? (3 Replies)
Discussion started by: redlotus72
3 Replies
Login or Register to Ask a Question