Method
GioFilemeasure_disk_usage
since: 2.38
Declaration
gboolean
g_file_measure_disk_usage (
GFile* file,
GFileMeasureFlags flags,
GCancellable* cancellable,
GFileMeasureProgressCallback progress_callback,
gpointer progress_data,
guint64* disk_usage,
guint64* num_dirs,
guint64* num_files,
GError** error
)
Description
Recursively measures the disk usage of file.
This is essentially an analog of the ‘du’ command, but it also reports the number of directories and non-directory files encountered (including things like symbolic links).
By default, errors are only reported against the toplevel file
itself. Errors found while recursing are silently ignored, unless
G_FILE_MEASURE_REPORT_ANY_ERROR is given in flags.
The returned size, disk_usage, is in bytes and should be formatted
with g_format_size() in order to get something reasonable for showing
in a user interface.
progress_callback and progress_data can be given to request
periodic progress updates while scanning. See the documentation for
GFileMeasureProgressCallback for information about when and how the
callback will be invoked.
Available since: 2.38
Parameters
flags-
Type:
GFileMeasureFlagsGFileMeasureFlags. cancellable-
Type:
GCancellableOptional
GCancellable.The argument can be NULL.The data is owned by the caller of the method. progress_callback-
Type:
GFileMeasureProgressCallbackA
GFileMeasureProgressCallback.The argument can be NULL. progress_data-
Type:
gpointerUser_data for
progress_callback.The argument can be NULL.The data is owned by the caller of the method. disk_usage-
Type:
guint64*The number of bytes of disk space used.
The argument will be set by the function. The argument can be NULL. num_dirs-
Type:
guint64*The number of directories encountered.
The argument will be set by the function. The argument can be NULL. num_files-
Type:
guint64*The number of non-directories encountered.
The argument will be set by the function. The argument can be NULL. error-
Type:
GError **The return location for a recoverable error.
The argument can be NULL.If the return location is not NULL, then you must initialize it to aNULLGError*.The argument will be left initialized to NULLby the method if there are no errors.In case of error, the argument will be set to a newly allocated GError; the caller will take ownership of the data, and be responsible for freeing it.