Find the answer to your Linux question:
Results 1 to 2 of 2
I need to frequently sweep out a bunch subdirectories. I usually just use rm -rf * (and yes I know how dangerous this can be ....) but now have a ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Nov 2009
    Posts
    4

    excluding some directories when using rm -rf *


    I need to frequently sweep out a bunch subdirectories. I usually just use rm -rf * (and yes I know how dangerous this can be ....) but now have a two subdirectories I need to leave there while removing the rest. I've been looking, but cannot find out how to add an "exclude" to rm ... much like tar, for example, allows you to exclude directories with --exclude. Any ideas?

  2. #2
    Linux Guru
    Join Date
    Nov 2007
    Posts
    1,755

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •