FileT.measureDiskUsage

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_DISK_USAGE_REPORT_ALL_ERRORS 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.

template FileT(TStruct)
bool
measureDiskUsage
(
GFileMeasureFlags flags
,
Cancellable cancellable
,
GFileMeasureProgressCallback progressCallback
,,
out ulong diskUsage
,
out ulong numDirs
,
out ulong numFiles
)

Parameters

flags GFileMeasureFlags

#GFileMeasureFlags

cancellable Cancellable

optional #GCancellable

progressCallback GFileMeasureProgressCallback

a #GFileMeasureProgressCallback

progressData void*

user_data for @progress_callback

diskUsage ulong

the number of bytes of disk space used

numDirs ulong

the number of directories encountered

numFiles ulong

the number of non-directories encountered

Return Value

Type: bool

%TRUE if successful, with the out parameters set. %FALSE otherwise, with @error set.

Throws

GException on failure.

Meta

Since

2.38