set dir for array and string