KIO::DirectorySizeJob Class

class KIO::DirectorySizeJob

Computes a directory size. More...

Header: #include <KIO/DirectorySizeJob>
CMake: find_package(KF6 REQUIRED COMPONENTS KIO)
target_link_libraries(mytarget PRIVATE KF6::KIOCore)
Inherits: KIO::Job

Public Functions

KIO::filesize_t totalFiles() const
KIO::filesize_t totalSize() const
KIO::filesize_t totalSubdirs() const
KIO::DirectorySizeJob *directorySize(const KFileItemList &lstItems)
KIO::DirectorySizeJob *directorySize(const QUrl &directory)

Detailed Description

Similar to "du", but doesn't give the same results since we simply sum up the dir and file sizes, whereas du speaks disk blocks.

See also KIO::directorySize.

Member Function Documentation

KIO::filesize_t DirectorySizeJob::totalFiles() const

Returns the total number of files (counting symlinks to files, sockets and character devices as files) in this directory and all sub-directories

KIO::filesize_t DirectorySizeJob::totalSize() const

Returns the size we found

KIO::filesize_t DirectorySizeJob::totalSubdirs() const

Returns the total number of sub-directories found (not including the directory the search started from and treating symlinks to directories as directories)

Related Non-Members

KIO::DirectorySizeJob *directorySize(const KFileItemList &lstItems)

Computes a directory size (by doing a recursive listing). Connect to the result signal (this is the preferred solution to avoid blocking the GUI), or use exec() for a synchronous (blocking) calculation.

This one lists the items from lstItems. The reason we asks for items instead of just urls, is so that we directly know if the item is a file or a directory, and in case of a file, we already have its size.

KIO::DirectorySizeJob *directorySize(const QUrl &directory)

Computes a directory size (by doing a recursive listing). Connect to the result signal (this is the preferred solution to avoid blocking the GUI), or use exec() for a synchronous (blocking) calculation.

This one lists a single directory.