Function rcutils_calculate_directory_size

Function Documentation

rcutils_ret_t rcutils_calculate_directory_size(const char *directory_path, uint64_t *size, rcutils_allocator_t allocator)

Calculate the size of the specified directory.

Calculates the size of a directory by summarizing the file size of all files.

Note

This operation is not recursive.

Parameters:
  • directory_path[in] The directory path to calculate the size of.

  • size[out] The size of the directory in bytes on success.

  • allocator[in] Allocator being used for internal file path composition.

Returns:

RCUTILS_RET_OK if successful, or

Returns:

RCUTILS_RET_INVALID_ARGUMENT for invalid arguments, or

Returns:

RCUTILS_RET_BAD_ALLOC if memory allocation fails

Returns:

RCUTILS_RET_ERROR if other error occurs