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.

Assuming that there are no directories ending in .arc:

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

Thanks!

Hhhhmmm still not exactly what I am looking for in the results.

put the extra code in below

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

BR

I tried that but I get the same results....
What exactly does that do?

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?

omnibus_procedure_scripts is a directory.

---------- Post updated at 03:54 AM ---------- Previous update was at 03:53 AM ----------

Still not sure I am getting what I am after....

I need to search only the directory I am in for any .arc files (no sub directories) and I need to turn the results into a count.
It seems like the find command works in the current directory but also drills into all sub directories.

So for example if there was 3 files with the ext .arc then the results returned would be 3.
That way I can look at the result number to see if any were found.

Also I am using this on Solaris and Linux so I am not sure if the commands would be the same.

Thank you for the help.

if you put the syntax like below you will search the current directory only.

find /path/of/the/directory/*.arc  -mtime +1  2>/dev/null
                            ^^^^ #file name
if you write the syntax like below you will search the directory and its sub-directory

find /path/of/the/directory  -name "*.arc"  -mtime +1  2>/dev/null
                                     ^^^^ #file name

BR

Ok I see what you mean now :slight_smile:
Yes that does seem to work. Now how would I turn that into a count though for the output? For example if it does find a .sh file.

For example if there are 3 files in that directory...

file1.pl
file2.sh
file3.pl

And I do the command it should come back with a result of
1

Because there was only 1 file with a .sh ext. If there are none then it should result in a 0 for the output.

Thanks again for the help.

---------- Post updated at 04:28 AM ---------- Previous update was at 04:24 AM ----------

Ok I think its close....
kraken:/lcl/prd/data/entp/archives>find /lcl/prd/data/entp/archives/*.arc -mtime +1 2>/dev/null | wc -l
0

Only thing is why does the 0 show up so much to the right on Solaris?

Just pipe the output to wc -l command

find /path/of/the/directory/*.arc  -mtime +1  2>/dev/null | wc -l