Finding files for which a command failsFinding a substring in files across subdirectories with a single built-in command?Find a file in lots of zip files (like find command for directories)Finding all “Non-Binary” filesHow to count recursively for the number of files in several directories?Which command to use to find all files/folders with non-default permissions?List files recursively in Linux CLI with path relative to the current directory, max 250 charFind command fails to copy few filesFinding files that have been modified using a script?Finding files and directories with different umaskAggregate status code from sub-scripts in a script

Random Forest different results for same observation

How would 10 generations of living underground change the human body?

Check if a string is entirely made of the same substring

How can I practically buy stocks?

Why was the Spitfire's elliptical wing almost uncopied by other aircraft of World War 2?

As an international instructor, should I openly talk about my accent?

What's the polite way to say "I need to urinate"?

Coordinate my way to the name of the (video) game

How does Captain America channel this power?

Multiple options vs single option UI

I preordered a game on my Xbox while on the home screen of my friend's account. Which of us owns the game?

'It addicted me, with one taste.' Can 'addict' be used transitively?

Extension of 2-adic valuation to the real numbers

What happens in the secondary winding if there's no spark plug connected?

How could Tony Stark make this in Endgame?

How did Captain America manage to do this?

Why boldmath fails in a tikz node?

Why does Mind Blank stop the Feeblemind spell?

How to denote matrix elements succinctly?

Was there a shared-world project before "Thieves World"?

Contradiction proof for inequality of P and NP?

Is there really no use for MD5 anymore?

Why does nature favour the Laplacian?

'regex' and 'name' directives in find



Finding files for which a command fails


Finding a substring in files across subdirectories with a single built-in command?Find a file in lots of zip files (like find command for directories)Finding all “Non-Binary” filesHow to count recursively for the number of files in several directories?Which command to use to find all files/folders with non-default permissions?List files recursively in Linux CLI with path relative to the current directory, max 250 charFind command fails to copy few filesFinding files that have been modified using a script?Finding files and directories with different umaskAggregate status code from sub-scripts in a script






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








26















I would like to recursively find all the files for which a script which accepts a file as an argument returns a non-zero value. Any idea how to do this using 'find' or a similar tool?










share|improve this question






























    26















    I would like to recursively find all the files for which a script which accepts a file as an argument returns a non-zero value. Any idea how to do this using 'find' or a similar tool?










    share|improve this question


























      26












      26








      26


      7






      I would like to recursively find all the files for which a script which accepts a file as an argument returns a non-zero value. Any idea how to do this using 'find' or a similar tool?










      share|improve this question
















      I would like to recursively find all the files for which a script which accepts a file as an argument returns a non-zero value. Any idea how to do this using 'find' or a similar tool?







      files scripting find exit-status






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Apr 14 at 13:21









      Jeff Schaller

      45.4k1164147




      45.4k1164147










      asked Apr 8 at 5:05









      mitanyenmitanyen

      13313




      13313




















          1 Answer
          1






          active

          oldest

          votes


















          38














          find’s -exec action can be used for this:



          find . ! -exec yourscript ; -print


          will print the names of all files for which yourscript fails.



          -exec can be used in this way to turn appropriate external commands into find tests.






          share|improve this answer




















          • 8





            Equivalently, using -o (or): find . -exec yourscript ; -o -print.

            – John Kugelman
            Apr 8 at 19:07











          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f511154%2ffinding-files-for-which-a-command-fails%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          38














          find’s -exec action can be used for this:



          find . ! -exec yourscript ; -print


          will print the names of all files for which yourscript fails.



          -exec can be used in this way to turn appropriate external commands into find tests.






          share|improve this answer




















          • 8





            Equivalently, using -o (or): find . -exec yourscript ; -o -print.

            – John Kugelman
            Apr 8 at 19:07















          38














          find’s -exec action can be used for this:



          find . ! -exec yourscript ; -print


          will print the names of all files for which yourscript fails.



          -exec can be used in this way to turn appropriate external commands into find tests.






          share|improve this answer




















          • 8





            Equivalently, using -o (or): find . -exec yourscript ; -o -print.

            – John Kugelman
            Apr 8 at 19:07













          38












          38








          38







          find’s -exec action can be used for this:



          find . ! -exec yourscript ; -print


          will print the names of all files for which yourscript fails.



          -exec can be used in this way to turn appropriate external commands into find tests.






          share|improve this answer















          find’s -exec action can be used for this:



          find . ! -exec yourscript ; -print


          will print the names of all files for which yourscript fails.



          -exec can be used in this way to turn appropriate external commands into find tests.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Apr 8 at 5:56

























          answered Apr 8 at 5:20









          Stephen KittStephen Kitt

          183k26420500




          183k26420500







          • 8





            Equivalently, using -o (or): find . -exec yourscript ; -o -print.

            – John Kugelman
            Apr 8 at 19:07












          • 8





            Equivalently, using -o (or): find . -exec yourscript ; -o -print.

            – John Kugelman
            Apr 8 at 19:07







          8




          8





          Equivalently, using -o (or): find . -exec yourscript ; -o -print.

          – John Kugelman
          Apr 8 at 19:07





          Equivalently, using -o (or): find . -exec yourscript ; -o -print.

          – John Kugelman
          Apr 8 at 19:07

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Unix & Linux Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f511154%2ffinding-files-for-which-a-command-fails%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Adding axes to figuresAdding axes labels to LaTeX figuresLaTeX equivalent of ConTeXt buffersRotate a node but not its content: the case of the ellipse decorationHow to define the default vertical distance between nodes?TikZ scaling graphic and adjust node position and keep font sizeNumerical conditional within tikz keys?adding axes to shapesAlign axes across subfiguresAdding figures with a certain orderLine up nested tikz enviroments or how to get rid of themAdding axes labels to LaTeX figures

          Tähtien Talli Jäsenet | Lähteet | NavigointivalikkoSuomen Hippos – Tähtien Talli

          Do these cracks on my tires look bad? The Next CEO of Stack OverflowDry rot tire should I replace?Having to replace tiresFishtailed so easily? Bad tires? ABS?Filling the tires with something other than air, to avoid puncture hassles?Used Michelin tires safe to install?Do these tyre cracks necessitate replacement?Rumbling noise: tires or mechanicalIs it possible to fix noisy feathered tires?Are bad winter tires still better than summer tires in winter?Torque converter failure - Related to replacing only 2 tires?Why use snow tires on all 4 wheels on 2-wheel-drive cars?