Improved file scan in directories