Fix typo in variable name
unified calls to fs function vs duplicate functions for file and
directory
Merge pull request #7531 from bcoca/make_one_fs_function

Make one fs function