Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How find files that are more then certain days ? 2

Status
Not open for further replies.

buccaneers

Programmer
Jun 3, 2004
28
US
Hello Guru's,

I have a question if i may ask. I am trying to find files older then certain number of days from current date. I thought you could do this with find cmd, but unfortunatey this is not working for me or i am not using the cmd correctly.

I was using following cmd to list files in a dir older then 60 days.

find /home/logs -mtime +60 -name "*.log"

and i am getting this error.

find: 0652-019 The status on /home/logs is not valid.


TIA,

--LN

 
Your find command should do what you want provided you have the right permissions and that the filesystem doesn't need some repair.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thx PHV.

Is there any other way to get this list ?

TIA,

LN
 
I'm not sure how to read your question.

Of course there are other ways to do it. You could, for example, do an "ls -lR" and pipe that to a shell script that examined the date fields. That would be medium hard, and probably slow. You could write a Perl script that walked the directory tree, did a stat, and compared times. Not very hard to do, and probably runs only a little slower than find.

But the problem you are having has something to do /home/logs, not find itself, so even if you did implement something else, it would probably have the same problem.

It might be of value to try "stat /home/logs" and see what that says. Example:

Code:
# stat `pwd`
  File: `/root/custdat/quantum'
  Size: 4096            Blocks: 8          IO Block: 4096   Directory
Device: 1643h/5699d     Inode: 294450      Links: 2    
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2005-05-24 15:39:22.000000000 -0400
Modify: 2005-05-24 15:39:11.000000000 -0400
Change: 2005-05-24 15:39:11.000000000 -0400

Tony Lawrence
Linux/Unix/Mac OS X Resources
 
I got a very similar error using AIX 5.1 when the file system was mounted over a mount point with insufficient permissions. So wheh you did ls -ld /home/logs you got drwxrwxrwx permissions but when /home/logs was unmounted the permissions were drwxr-x---.

The only solution was to unmount the filesystem, fix the permissions (chmod 777 /home/logs) and remount it.

As you can imagine this one kept me stumped for a while.

Columb Healy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top