Is there any resultant difference on disk between using rm or rmdir to remove a directory?
Or is it only different by usage preference, By example, given
$ mkdir a
$ mkdir a/b
$ mkdir a/b/c
Would
$ rmdir -p a/b/c
have the same effect as
$ rm -r a
just looking at it from a different end?
rmdir
is a little safer, sometimes. If you issuemkdir test
and thentouch test\a
and thenrmdir test
, you will get an error that the directory is not empty. If you issuerm -r test
.....rmdir
removes only empty directories , whilerm -r
will remove even non-empty directories