create missing directories with correct mode