3

I want to delete all hidden directoris from a directory and its sub-directory. I also use rm -rf .directory_name this command is iterative command I want to a recursive command. Please anybody help me??

1
  • 1
    Why do you call rm -rf iterative? The -r stands for recursive. :-)
    – Mikel
    Commented Apr 5, 2014 at 16:33

1 Answer 1

10

It sounds like you want something like this (although it's not clear what you mean when distinguishing "iterative command" from "recursive command", since rm -rf is both recursive and iterative):

LC_ALL=C find . -name '.?*' -type d -exec echo rm -rf {} +

Once you're happy, remove echo from the option arguments to -exec to remove the listed directories.

1
  • 1
    I'd upvote that again if I could. Great answer!
    – unigeek
    Commented Mar 9, 2021 at 16:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .