The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > OS Specific Forums > Linux
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #12 (permalink)  
Old 04-13-2008
radoulov's Avatar
radoulov radoulov is offline
addict
 

Join Date: Jan 2007
Location: Milan, Italy/Varna, Bulgaria
Posts: 1,432
Quote:
Originally Posted by ghostdog74 View Post
yes, that's why rm -f */ is the simplest solution to his problem. No doubt about that.

Just to make it clear,
I don't think ls and awk are needed in the case you describe (argument list too long).

Code:
for d in */;do rm -r "$d";done
Or better (needs to be adjusted for xargs that doesn't support the null option):

Code:
xargs -0n1000 rm -r < <(printf "%s\000" */)
If you have zsh:

Code:
autoload -U zargs
zargs *(/) -- rm -r

Last edited by radoulov; 04-13-2008 at 10:36 AM. Reason: corrected
Reply With Quote