Optimize file transferring logic and fix PathSeparator to DirSeparator