[aklug] Linux/BSD: Why do directories need to be empty?

From: Christopher Howard <christopher.howard@frigidcode.com>
Date: Sat May 14 2011 - 15:51:42 AKDT

Why is it that on Linux and BSDs that the system requires directories to
be empty before they are deleted? A directory is fundamentally just a
file, right? Why shouldn't I be able to just unlink it and let the child
files disappear by virtue of having no more references to them in the
file system tree? Instead of that simple approach, I have to recursively
unlink every child file and rmdir every subdirectory (or, of course, let
"rm -rf" do it for me.) Seems lame.

This was kind of problematic for me the other day because I had a script
that was supposed to "rm -rf" a certain backup directory, but it
actually wasn't doing it completely because there were some
subdirectories that didn't have their write permission bits set.

-- 
frigidcode.com
theologia.indicium.us
---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
Received on Sat May 14 15:51:27 2011

This archive was generated by hypermail 2.1.8 : Sat May 14 2011 - 15:51:27 AKDT