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;
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 *.origrm -R *.orig
uninstall delete
add a comment
|
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 *.origrm -R *.orig
uninstall delete
Take a look at superuser.com/a/699287/92334
– Lu55
Oct 22 '18 at 21:07
add a comment
|
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 *.origrm -R *.orig
uninstall delete
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 *.origrm -R *.orig
uninstall delete
uninstall delete
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
add a comment
|
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
add a comment
|
3 Answers
3
active
oldest
votes
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.
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-maxdepthor-mindeptharguments.
– Oli♦
May 26 '13 at 9:37
6
Definitely leave the-deleteat 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 withgit clean -fdx
– kyb
Aug 10 '18 at 19:56
1
@kamal I'd probably still use find but with its-regexor-iregexpredicates. Parsing filenames (when you're piping them around) can be hard to do safely sometimes.
– Oli♦
Dec 17 '18 at 14:29
|
show 4 more comments
"find" has some very advanced techniques to search through all or current directories and rm files.
find ./ -name ".orig" -exec rm -rf ;
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, andfindhas-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
|
show 1 more comment
I have removed all files that starts with .nfs000000000 like this
rm .nfs000000000*
add a comment
|
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
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-maxdepthor-mindeptharguments.
– Oli♦
May 26 '13 at 9:37
6
Definitely leave the-deleteat 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 withgit clean -fdx
– kyb
Aug 10 '18 at 19:56
1
@kamal I'd probably still use find but with its-regexor-iregexpredicates. Parsing filenames (when you're piping them around) can be hard to do safely sometimes.
– Oli♦
Dec 17 '18 at 14:29
|
show 4 more comments
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.
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-maxdepthor-mindeptharguments.
– Oli♦
May 26 '13 at 9:37
6
Definitely leave the-deleteat 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 withgit clean -fdx
– kyb
Aug 10 '18 at 19:56
1
@kamal I'd probably still use find but with its-regexor-iregexpredicates. Parsing filenames (when you're piping them around) can be hard to do safely sometimes.
– Oli♦
Dec 17 '18 at 14:29
|
show 4 more comments
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.
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.
answered May 18 '11 at 19:08
Oli♦Oli
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-maxdepthor-mindeptharguments.
– Oli♦
May 26 '13 at 9:37
6
Definitely leave the-deleteat 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 withgit clean -fdx
– kyb
Aug 10 '18 at 19:56
1
@kamal I'd probably still use find but with its-regexor-iregexpredicates. Parsing filenames (when you're piping them around) can be hard to do safely sometimes.
– Oli♦
Dec 17 '18 at 14:29
|
show 4 more comments
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-maxdepthor-mindeptharguments.
– Oli♦
May 26 '13 at 9:37
6
Definitely leave the-deleteat 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 withgit clean -fdx
– kyb
Aug 10 '18 at 19:56
1
@kamal I'd probably still use find but with its-regexor-iregexpredicates. 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
|
show 4 more comments
"find" has some very advanced techniques to search through all or current directories and rm files.
find ./ -name ".orig" -exec rm -rf ;
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, andfindhas-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
|
show 1 more comment
"find" has some very advanced techniques to search through all or current directories and rm files.
find ./ -name ".orig" -exec rm -rf ;
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, andfindhas-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
|
show 1 more comment
"find" has some very advanced techniques to search through all or current directories and rm files.
find ./ -name ".orig" -exec rm -rf ;
"find" has some very advanced techniques to search through all or current directories and rm files.
find ./ -name ".orig" -exec rm -rf ;
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, andfindhas-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
|
show 1 more comment
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, andfindhas-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
|
show 1 more comment
I have removed all files that starts with .nfs000000000 like this
rm .nfs000000000*
add a comment
|
I have removed all files that starts with .nfs000000000 like this
rm .nfs000000000*
add a comment
|
I have removed all files that starts with .nfs000000000 like this
rm .nfs000000000*
I have removed all files that starts with .nfs000000000 like this
rm .nfs000000000*
answered May 29 at 12:41
Taras VaskivTaras Vaskiv
1711 silver badge3 bronze badges
1711 silver badge3 bronze badges
add a comment
|
add a comment
|
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
Take a look at superuser.com/a/699287/92334
– Lu55
Oct 22 '18 at 21:07