Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to find all files that are:

  • recent
  • do not end in .class
  • no directories

This is what I have attempted but it is not working:

find . \( -atime -1 -a \! -type d -a \! -name '.class' \) -ls

I simplified it to this:

find . -atime -1 -ls

But it is still picking up things from January and earlier. What is going wrong here?

share|improve this question
    
-a (and) is implied so you can omit those (and the parentheses). You probably also want a "*" in the name spec: \! -name '*.class' –  Dennis Williamson Feb 10 '10 at 20:41
    
I see you've already done that here: superuser.com/questions/107201/… –  Dennis Williamson Feb 10 '10 at 20:45

2 Answers 2

up vote 3 down vote accepted

You probably want either -mtime or -ctime. -atime checks the access time, which includes accessing the file metadata. So doing a ls (or a find -atime) will update the access time. -mtime is the time the file contents were last modified and -ctime is the last time the "status" was changed, which I think is the file metadata (permissions, etc).

share|improve this answer

Solutions use:

find . -ctime -1 -ls
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.