Fix file.recurse states with trailing slashes in source

Resolves #11002.