How do I remove all files that match a pattern?How to remove configuration files completelyHow to properly remove packagesHow to delete all the files/folders from the folder except few folders?remove files on NTFS with n in the filenameHow to remove multiple apps?How to delete folders that have n or fewer files in them?

How can a signal be both periodic and random?

Intuition for the derivative of the exponential function

You see a boat filled with people

Phrase: the sun is out

Are homeless people protected by antidiscrimination laws?

Why are Buddhist concepts so difficult?

I'm on the Titanic, what should I do to survive?

What would you do? Different results than what is reported

Implement the 2D Hadamard Transform

RX vs TX operation in Software UART

Clarification - Random Variable

Can we connect a specific Marketing Cloud's BU to a sandbox of service cloud?

Is there any physical evidence for motion?

If you have multiple planeswalkers, how many planeswalker abilities can you use in a single turn?

java type promotion in parameters

Showing a homeless person that you care about their well-being

How are astronauts in the ISS protected from electric shock?

How do I get softer pictures in sunlight, like in this commercial?

should I include offer letter from a different institution in my application for a faculty position

Is rent considered a debt?

Why didn't Petunia know that Harry wasn't supposed to use magic out of school?

Is 写真 an onomatopoeia?

Which audio encoders in FFmpeg support 8 kHz?

Why is Microwaved mac & cheese burnt where they touch?



How do I remove all files that match a pattern?


How to remove configuration files completelyHow to properly remove packagesHow to delete all the files/folders from the folder except few folders?remove files on NTFS with n in the filenameHow to remove multiple apps?How to delete folders that have n or fewer files in them?






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









75

















When I revert in Mercurial, it leaves several .orig files. I would like to be able to run a command to remove all of them.



I have found some sources that say to run:



rm **/*.orig



But that gives me the message:




rm: cannot remove `*/.orig': No such file or directory




I have also tried:



  • rm -rv *.orig


  • rm -R *.orig










share|improve this question


























  • Take a look at superuser.com/a/699287/92334

    – Lu55
    Oct 22 '18 at 21:07

















75

















When I revert in Mercurial, it leaves several .orig files. I would like to be able to run a command to remove all of them.



I have found some sources that say to run:



rm **/*.orig



But that gives me the message:




rm: cannot remove `*/.orig': No such file or directory




I have also tried:



  • rm -rv *.orig


  • rm -R *.orig










share|improve this question


























  • Take a look at superuser.com/a/699287/92334

    – Lu55
    Oct 22 '18 at 21:07













75












75








75


17






When I revert in Mercurial, it leaves several .orig files. I would like to be able to run a command to remove all of them.



I have found some sources that say to run:



rm **/*.orig



But that gives me the message:




rm: cannot remove `*/.orig': No such file or directory




I have also tried:



  • rm -rv *.orig


  • rm -R *.orig










share|improve this question















When I revert in Mercurial, it leaves several .orig files. I would like to be able to run a command to remove all of them.



I have found some sources that say to run:



rm **/*.orig



But that gives me the message:




rm: cannot remove `*/.orig': No such file or directory




I have also tried:



  • rm -rv *.orig


  • rm -R *.orig







uninstall delete






share|improve this question














share|improve this question











share|improve this question




share|improve this question










asked May 18 '11 at 19:04









JD IsaacksJD Isaacks

1,8179 gold badges23 silver badges27 bronze badges




1,8179 gold badges23 silver badges27 bronze badges















  • Take a look at superuser.com/a/699287/92334

    – Lu55
    Oct 22 '18 at 21:07

















  • Take a look at superuser.com/a/699287/92334

    – Lu55
    Oct 22 '18 at 21:07
















Take a look at superuser.com/a/699287/92334

– Lu55
Oct 22 '18 at 21:07





Take a look at superuser.com/a/699287/92334

– Lu55
Oct 22 '18 at 21:07










3 Answers
3






active

oldest

votes


















147


















Use the find command (with care!)



find . -name '*.orig' #-delete


I've commented out the delete command but once you're happy with what it's matching, just remove the # from the line and it should delete all those files.






share|improve this answer


























  • Does that work recursively?

    – Frank Barcenas
    May 25 '13 at 22:15






  • 2





    @FrankBarcenas Yeah - find does everything recursively. If you want to limit how that works, you can play with the -maxdepth or -mindepth arguments.

    – Oli
    May 26 '13 at 9:37






  • 6





    Definitely leave the -delete at the end of the flags. find . -delete -name '*.orig' will ignore the filter and clobber your whole directory.

    – Michael
    Nov 18 '15 at 17:02






  • 1





    @Michael, yes. I already solved the problem with git clean -fdx

    – kyb
    Aug 10 '18 at 19:56






  • 1





    @kamal I'd probably still use find but with its -regex or -iregex predicates. Parsing filenames (when you're piping them around) can be hard to do safely sometimes.

    – Oli
    Dec 17 '18 at 14:29


















6


















"find" has some very advanced techniques to search through all or current directories and rm files.



find ./ -name ".orig" -exec rm -rf ;





share|improve this answer





















  • 3





    What's the benefit over using -delete?

    – muru
    Dec 7 '15 at 22:25











  • @muru I suppose you'd get a prompt for each file if you remove -rf.

    – Peter
    Jul 12 '16 at 21:06











  • @Peter not necessarily. Even then, so? The answer uses -rf, and find has -ok.

    – muru
    Jul 12 '16 at 21:10












  • @muru it looks like -delete does not remove folders

    – Andrii Karaivanskyi
    Jul 31 '18 at 22:06











  • @AndriiKaraivanskyi unless the deletion failed, it does.

    – muru
    Jul 31 '18 at 22:07


















1


















I have removed all files that starts with .nfs000000000 like this



rm .nfs000000000*





share|improve this answer



























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "89"
    ;
    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: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    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/4.0/"u003ecc by-sa 4.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%2faskubuntu.com%2fquestions%2f43709%2fhow-do-i-remove-all-files-that-match-a-pattern%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown


























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    147


















    Use the find command (with care!)



    find . -name '*.orig' #-delete


    I've commented out the delete command but once you're happy with what it's matching, just remove the # from the line and it should delete all those files.






    share|improve this answer


























    • Does that work recursively?

      – Frank Barcenas
      May 25 '13 at 22:15






    • 2





      @FrankBarcenas Yeah - find does everything recursively. If you want to limit how that works, you can play with the -maxdepth or -mindepth arguments.

      – Oli
      May 26 '13 at 9:37






    • 6





      Definitely leave the -delete at the end of the flags. find . -delete -name '*.orig' will ignore the filter and clobber your whole directory.

      – Michael
      Nov 18 '15 at 17:02






    • 1





      @Michael, yes. I already solved the problem with git clean -fdx

      – kyb
      Aug 10 '18 at 19:56






    • 1





      @kamal I'd probably still use find but with its -regex or -iregex predicates. Parsing filenames (when you're piping them around) can be hard to do safely sometimes.

      – Oli
      Dec 17 '18 at 14:29















    147


















    Use the find command (with care!)



    find . -name '*.orig' #-delete


    I've commented out the delete command but once you're happy with what it's matching, just remove the # from the line and it should delete all those files.






    share|improve this answer


























    • Does that work recursively?

      – Frank Barcenas
      May 25 '13 at 22:15






    • 2





      @FrankBarcenas Yeah - find does everything recursively. If you want to limit how that works, you can play with the -maxdepth or -mindepth arguments.

      – Oli
      May 26 '13 at 9:37






    • 6





      Definitely leave the -delete at the end of the flags. find . -delete -name '*.orig' will ignore the filter and clobber your whole directory.

      – Michael
      Nov 18 '15 at 17:02






    • 1





      @Michael, yes. I already solved the problem with git clean -fdx

      – kyb
      Aug 10 '18 at 19:56






    • 1





      @kamal I'd probably still use find but with its -regex or -iregex predicates. Parsing filenames (when you're piping them around) can be hard to do safely sometimes.

      – Oli
      Dec 17 '18 at 14:29













    147














    147










    147









    Use the find command (with care!)



    find . -name '*.orig' #-delete


    I've commented out the delete command but once you're happy with what it's matching, just remove the # from the line and it should delete all those files.






    share|improve this answer














    Use the find command (with care!)



    find . -name '*.orig' #-delete


    I've commented out the delete command but once you're happy with what it's matching, just remove the # from the line and it should delete all those files.







    share|improve this answer













    share|improve this answer




    share|improve this answer










    answered May 18 '11 at 19:08









    OliOli

    232k95 gold badges589 silver badges781 bronze badges




    232k95 gold badges589 silver badges781 bronze badges















    • Does that work recursively?

      – Frank Barcenas
      May 25 '13 at 22:15






    • 2





      @FrankBarcenas Yeah - find does everything recursively. If you want to limit how that works, you can play with the -maxdepth or -mindepth arguments.

      – Oli
      May 26 '13 at 9:37






    • 6





      Definitely leave the -delete at the end of the flags. find . -delete -name '*.orig' will ignore the filter and clobber your whole directory.

      – Michael
      Nov 18 '15 at 17:02






    • 1





      @Michael, yes. I already solved the problem with git clean -fdx

      – kyb
      Aug 10 '18 at 19:56






    • 1





      @kamal I'd probably still use find but with its -regex or -iregex predicates. Parsing filenames (when you're piping them around) can be hard to do safely sometimes.

      – Oli
      Dec 17 '18 at 14:29

















    • Does that work recursively?

      – Frank Barcenas
      May 25 '13 at 22:15






    • 2





      @FrankBarcenas Yeah - find does everything recursively. If you want to limit how that works, you can play with the -maxdepth or -mindepth arguments.

      – Oli
      May 26 '13 at 9:37






    • 6





      Definitely leave the -delete at the end of the flags. find . -delete -name '*.orig' will ignore the filter and clobber your whole directory.

      – Michael
      Nov 18 '15 at 17:02






    • 1





      @Michael, yes. I already solved the problem with git clean -fdx

      – kyb
      Aug 10 '18 at 19:56






    • 1





      @kamal I'd probably still use find but with its -regex or -iregex predicates. Parsing filenames (when you're piping them around) can be hard to do safely sometimes.

      – Oli
      Dec 17 '18 at 14:29
















    Does that work recursively?

    – Frank Barcenas
    May 25 '13 at 22:15





    Does that work recursively?

    – Frank Barcenas
    May 25 '13 at 22:15




    2




    2





    @FrankBarcenas Yeah - find does everything recursively. If you want to limit how that works, you can play with the -maxdepth or -mindepth arguments.

    – Oli
    May 26 '13 at 9:37





    @FrankBarcenas Yeah - find does everything recursively. If you want to limit how that works, you can play with the -maxdepth or -mindepth arguments.

    – Oli
    May 26 '13 at 9:37




    6




    6





    Definitely leave the -delete at the end of the flags. find . -delete -name '*.orig' will ignore the filter and clobber your whole directory.

    – Michael
    Nov 18 '15 at 17:02





    Definitely leave the -delete at the end of the flags. find . -delete -name '*.orig' will ignore the filter and clobber your whole directory.

    – Michael
    Nov 18 '15 at 17:02




    1




    1





    @Michael, yes. I already solved the problem with git clean -fdx

    – kyb
    Aug 10 '18 at 19:56





    @Michael, yes. I already solved the problem with git clean -fdx

    – kyb
    Aug 10 '18 at 19:56




    1




    1





    @kamal I'd probably still use find but with its -regex or -iregex predicates. Parsing filenames (when you're piping them around) can be hard to do safely sometimes.

    – Oli
    Dec 17 '18 at 14:29





    @kamal I'd probably still use find but with its -regex or -iregex predicates. Parsing filenames (when you're piping them around) can be hard to do safely sometimes.

    – Oli
    Dec 17 '18 at 14:29













    6


















    "find" has some very advanced techniques to search through all or current directories and rm files.



    find ./ -name ".orig" -exec rm -rf ;





    share|improve this answer





















    • 3





      What's the benefit over using -delete?

      – muru
      Dec 7 '15 at 22:25











    • @muru I suppose you'd get a prompt for each file if you remove -rf.

      – Peter
      Jul 12 '16 at 21:06











    • @Peter not necessarily. Even then, so? The answer uses -rf, and find has -ok.

      – muru
      Jul 12 '16 at 21:10












    • @muru it looks like -delete does not remove folders

      – Andrii Karaivanskyi
      Jul 31 '18 at 22:06











    • @AndriiKaraivanskyi unless the deletion failed, it does.

      – muru
      Jul 31 '18 at 22:07















    6


















    "find" has some very advanced techniques to search through all or current directories and rm files.



    find ./ -name ".orig" -exec rm -rf ;





    share|improve this answer





















    • 3





      What's the benefit over using -delete?

      – muru
      Dec 7 '15 at 22:25











    • @muru I suppose you'd get a prompt for each file if you remove -rf.

      – Peter
      Jul 12 '16 at 21:06











    • @Peter not necessarily. Even then, so? The answer uses -rf, and find has -ok.

      – muru
      Jul 12 '16 at 21:10












    • @muru it looks like -delete does not remove folders

      – Andrii Karaivanskyi
      Jul 31 '18 at 22:06











    • @AndriiKaraivanskyi unless the deletion failed, it does.

      – muru
      Jul 31 '18 at 22:07













    6














    6










    6









    "find" has some very advanced techniques to search through all or current directories and rm files.



    find ./ -name ".orig" -exec rm -rf ;





    share|improve this answer














    "find" has some very advanced techniques to search through all or current directories and rm files.



    find ./ -name ".orig" -exec rm -rf ;






    share|improve this answer













    share|improve this answer




    share|improve this answer










    answered Dec 7 '15 at 21:50









    user2038042user2038042

    611 silver badge3 bronze badges




    611 silver badge3 bronze badges










    • 3





      What's the benefit over using -delete?

      – muru
      Dec 7 '15 at 22:25











    • @muru I suppose you'd get a prompt for each file if you remove -rf.

      – Peter
      Jul 12 '16 at 21:06











    • @Peter not necessarily. Even then, so? The answer uses -rf, and find has -ok.

      – muru
      Jul 12 '16 at 21:10












    • @muru it looks like -delete does not remove folders

      – Andrii Karaivanskyi
      Jul 31 '18 at 22:06











    • @AndriiKaraivanskyi unless the deletion failed, it does.

      – muru
      Jul 31 '18 at 22:07












    • 3





      What's the benefit over using -delete?

      – muru
      Dec 7 '15 at 22:25











    • @muru I suppose you'd get a prompt for each file if you remove -rf.

      – Peter
      Jul 12 '16 at 21:06











    • @Peter not necessarily. Even then, so? The answer uses -rf, and find has -ok.

      – muru
      Jul 12 '16 at 21:10












    • @muru it looks like -delete does not remove folders

      – Andrii Karaivanskyi
      Jul 31 '18 at 22:06











    • @AndriiKaraivanskyi unless the deletion failed, it does.

      – muru
      Jul 31 '18 at 22:07







    3




    3





    What's the benefit over using -delete?

    – muru
    Dec 7 '15 at 22:25





    What's the benefit over using -delete?

    – muru
    Dec 7 '15 at 22:25













    @muru I suppose you'd get a prompt for each file if you remove -rf.

    – Peter
    Jul 12 '16 at 21:06





    @muru I suppose you'd get a prompt for each file if you remove -rf.

    – Peter
    Jul 12 '16 at 21:06













    @Peter not necessarily. Even then, so? The answer uses -rf, and find has -ok.

    – muru
    Jul 12 '16 at 21:10






    @Peter not necessarily. Even then, so? The answer uses -rf, and find has -ok.

    – muru
    Jul 12 '16 at 21:10














    @muru it looks like -delete does not remove folders

    – Andrii Karaivanskyi
    Jul 31 '18 at 22:06





    @muru it looks like -delete does not remove folders

    – Andrii Karaivanskyi
    Jul 31 '18 at 22:06













    @AndriiKaraivanskyi unless the deletion failed, it does.

    – muru
    Jul 31 '18 at 22:07





    @AndriiKaraivanskyi unless the deletion failed, it does.

    – muru
    Jul 31 '18 at 22:07











    1


















    I have removed all files that starts with .nfs000000000 like this



    rm .nfs000000000*





    share|improve this answer






























      1


















      I have removed all files that starts with .nfs000000000 like this



      rm .nfs000000000*





      share|improve this answer




























        1














        1










        1









        I have removed all files that starts with .nfs000000000 like this



        rm .nfs000000000*





        share|improve this answer














        I have removed all files that starts with .nfs000000000 like this



        rm .nfs000000000*






        share|improve this answer













        share|improve this answer




        share|improve this answer










        answered May 29 at 12:41









        Taras VaskivTaras Vaskiv

        1711 silver badge3 bronze badges




        1711 silver badge3 bronze badges































            draft saved

            draft discarded















































            Thanks for contributing an answer to Ask Ubuntu!


            • 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%2faskubuntu.com%2fquestions%2f43709%2fhow-do-i-remove-all-files-that-match-a-pattern%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

            Distance measures on a map of a game The 2019 Stack Overflow Developer Survey Results Are Inmin distance in a graphShortest distance path on contour plotHow to plot a tilted map?Finding points outside of a diskDelaunay link distanceAnnulus from GeoDisks: drawing a ring on a mapNegative Correlation DistanceFind distance along a path (GPS coordinates)Finding position at given distance in a GeoPathMathematics behind distance estimation using camera

            How to get a smooth, uniform ParametricPlot of a 2D Region?How to plot a complicated Region?How to exclude a region from ParametricPlotHow discretize a region placing vertices on a specific non-uniform gridHow to transform a Plot or a ParametricPlot into a RegionHow can I get a smooth plot of a bounded region?Smooth ParametricPlot3D with RegionFunction?Smooth border of a region ParametricPlotSmooth region boundarySmooth region plot from list of pointsGet minimum y of a certain x in a region

            Genealogie vun de Merowenger Vum Merowech bis zum Chilperich I. | Navigatiounsmenü