optimize directoryUtil