Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

2
  • Thanks @ilkkachu : "you don't need all leaves (from all directories) first?" - you know what, turns out I don't really ; didn't think about that at all :) This answer works grep for the OP Q example; for my A example (where the root node might be the only instance having the "needle" substring) I get a mv: cannot move ‘./someotherdir’ to a subdirectory of itself, warning, but it does what it should. Thanks again! Commented Dec 6, 2017 at 21:23
  • 1
    @sdaau, ah of course, the replacement doesn't change anything if the keyword isn't there, so it's useless to try to rename. Ok, we could add a test inside the shell snippet, or just add a filter on the find... (edited) Commented Dec 6, 2017 at 22:00