Fix removal of subdirectories.

The previous commit to fix directory tree removal didn't take into account
the case of nested subdirs, ie. "dir/subdir/file", where the whole tree
is removed.

Pointed out by Samrat Revagade.