Check the change from basePath to basePath.FullPath. We were also appending DirectorySeparatorChar to files and it was being counted as a directory, while it was not.