Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: listing/deleting empty directories recursively
- X-seq: zsh-users 9700
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zzapper <david@xxxxxxxxxx>, zsh-users@xxxxxxxxxx
- Subject: Re: listing/deleting empty directories recursively
- Date: Sat, 19 Nov 2005 16:09:31 +0000
- In-reply-to: <103un195cji6u17l0kj1ijkvfj2vn9o3r5@xxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <tfrtn1dt9nf26m1rka6b9kg3bmcoa2evs4@xxxxxxx> <200511191057.25776.cht@xxxxxxxxx> <103un195cji6u17l0kj1ijkvfj2vn9o3r5@xxxxxxx>
On Nov 19, 11:28am, zzapper wrote:
} Subject: Re: listing/deleting empty directories recursively
}
} >ls -ld **/*(/^F)
} >
} >Christian
}
} Now I'd like to rm those directories, and log which ones were deleted.
On a GNU-ish system?
rmdir --verbose **/*(/^F)
You can work out the stderr redirections yourself.
Of course you realize that this only finds/removes empty leaf directories.
Every time you remove a directory you might discover that its parent has
also become empty. For that reason you might be better off doing a depth-
first traversal attempting to remove *all* directories, and simply allow
rmdir to fail if the directory isn't empty.
rmdir --verbose **/*(/od)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author