Further implement directory sync. Improve file sync.