finish dir function