The manpage for find says:

   -prune True;  if  the file is a directory, do not descend into it. If -depth is 
          given, false; no effect.  Because -delete implies -depth, you cannot 
          usefully use -prune and -delete together.

What is the meaning of the last sentence? Can't one usefully run the below command...

find /path/ -prune -type f -ctime +15 -delete

... to find and delete all files last changed more than 15 days ago in /path/ but not in the subdirectories under /path/? I think it's a perfectly valid use case.

1 Answer 1


Looks like the problem is that -prune is ineffective if -depth is also used and -delete implies -depth.

As for the use case you're asking about, I've always used -maxdepth X.

For example

find /path/ -maxdepth 1 -type f -ctime +15 -delete

will do.

  • 1
    You're right. Use of -delete automatically turns on the `-depth' option., says the manpage just a few lines before. Guess I completely missed out that bit.
    – dr_
    Commented Sep 18, 2018 at 14:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .