This also doesn't work for symbolic links, since `isfile(p)` currently returns `false` for a symbolic link to a directory, and yet `rmdir(p)` doesn't work for symbolic links to directories.