Use os.path.normpath to deal with slashes

Remove functions about dealing with slashes. Now use `os.path.normpath`
as it's better on cross-platform issue.

Also extract the sub directory finding logic in `traverse_files` to a
function.