let try_create_dir dirname perm =
  try (Unix.mkdir dirname perm; assert (is_directory dirname); true)
  with | Unix.Unix_error _ -> false