[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [leafnode-list] Monster directory hierarchy



[...]
>    Cornelius> Yes. (How did you accomplish this?)
>
>I would use:
>
>find <dirname> -type d | xargs rmdir

Actually, I did:

find <dirname> -type d | tac | xargs rmdir --verbose --ignore-fail-on-non-empty

The tac makes all the deletions occur in one pass, because find will emit the 
parent before the subdirectories (tac reverses the order of lines in a file 
--- cat backwards). The --ignore-fail-on-non-empty prevents rmdir barfing the 
first time it finds a populated directory.

Actually, because the initial find took about ten minutes, I split it up into 
two sections with a temporary file, but that was the essence.

I now have 20 entries in /var/spool/news. Ta.

-- 
+- David Given ---------------McQ-+ 
|  Work: dg@xxxxxxxxxxxxx         | FNORD                                     
|  Play: dgiven@xxxxxxxxx         | 
+- http://wired.st-and.ac.uk/~dg -+ 



-- 
leafnode-list@xxxxxxxxxxxxxxxxxxxxxxxxxxxx -- mailing list for leafnode
To unsubscribe, send mail with "unsubscribe" in the subject to the list