Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So, I'm trying to get all files older than 40 days. (hence the -mtime -40), but can't find because some files have invalid predicates. (Need to find all files whether in current or descendant.

$ find . -name * -mtime -40 > FILE_LIST
find: invalid predicate `-file-name.xls'

And then...

$ find ./* -name * -mtime -40 > FILE_LIST
find: invalid predicate `-file-name.xls'

And neither of these seem to do it.

share|improve this question
up vote 1 down vote accepted

I think the problem is that the * in your -name * is being expanded to a file list by the shell which is then passed to find on it's command line. The find command then parses the command line and finds the -file-name.xls which it tries to interpret as a command line argument.


find .  -mtime -40 > FILE_LIST

which should do what you want.

share|improve this answer
This did exactly what I needed :). I guess I tried to bite off more upfront than I needed to. Thanks for the great explanation as well – Jeff Ancel Jan 19 '12 at 19:13
this works since -name * doesn't do anything in this case (since it means "every possible name", its not changing the output. Note that if you DID need to do something similar you should single-quote the * so that the shell doesn't try to do this expansion. so find . -name '*' -mtime -40 would have worked for you. – stew Jan 19 '12 at 19:26
@stew: yup <!-- filler – Iain Jan 19 '12 at 19:36

AHHHH....If you read the man page -mtime -40 will give you files LESS THAN 40 days old. Isn't what you want to do is this:

 find . -mtime +40 >FILE_LIST

if you want to find/list files GREATER THAN 40 days old.

share|improve this answer
You're right, the above post should be modified. In my case, I did do +40, and the explanation was good above and it was resolved. – Jeff Ancel Jan 20 '12 at 17:32

Your Answer


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.