Improve the performance issue on rescanning directories