file.directory: fix cleaning directory symlinks

With a file.directory state, using the 'clean' directive, some symlinks
could not be removed, raising exception:
  OSError: Cannot call rmtree on a symbolic link

The reason is that valid symlinks for directories are returned
by 'os.walk' as directories.

This commit checks if directories are, in fact, symlinks, and treats them
as simple files.
Merge pull request #12962 from dr4Ke/fix_file_directory_clean_symlinks

file.directory: fix cleaning directory symlinks