improve syncDirectory

improve syncDirectory