View previous topic :: View next topic |
Author |
Message |
lonrot_m Apprentice
Joined: 18 Jun 2005 Posts: 274 Location: Mexico
|
Posted: Thu Sep 28, 2006 10:40 pm Post subject: erase automatically empty folders [Solved] |
|
|
Hi:
Well like the subject says i would like to create a command that erases the folders that are empty, my idea would be first get the size of that folder with du --max-depth=1
and then the ones that have 0k erase them but i dont really know how to start or how to do it, so i was wondering if anyone already knows how to do it or if they have a suggestion
thanks
lonrot _________________ The only fool bigger than the person who knows it all is the person who argues with him.
Last edited by lonrot_m on Fri Sep 29, 2006 2:26 am; edited 1 time in total |
|
Back to top |
|
|
BlackEdder Advocate
Joined: 26 Apr 2004 Posts: 2588 Location: Dutch enclave in Egham, UK
|
Posted: Thu Sep 28, 2006 10:54 pm Post subject: |
|
|
rmdir removes only empty folders so you should be able to use that:
This should remove all rthe empty folders on your system. I have not tested it at all though, so I suggest you first test it before it eats your dog |
|
Back to top |
|
|
lonrot_m Apprentice
Joined: 18 Jun 2005 Posts: 274 Location: Mexico
|
Posted: Fri Sep 29, 2006 2:26 am Post subject: |
|
|
that works although i first i need to run it like this
because if the folder contains a folder although it isn't empty it doesn't erase it so first we must erase the one inside
thanks a lot _________________ The only fool bigger than the person who knows it all is the person who argues with him. |
|
Back to top |
|
|
|