'find -execdir' opens too many file descriptors

Solution Verified - Updated -

Issue

  • find -execdir opens too many file descriptors
  • When using the -execdir option to find, the program apparently opens a new file descriptor every time it runs the command, and never closes it.
  • As a result, when traversing a directory tree that contains more than $(ulimit -n) files (1024 by default), find will fail with the message:
  find: Failed to save working directory in order to run a command on `foo': Too many open files

Environment

  • Red Hat Enterprise Linux 7
  • findutils-4.5.11-5.el7.x86_64

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content