FileHelperRK
Loading...
Searching...
No Matches
Public Member Functions | Data Fields
FileHelperRK::Usage Class Reference

Measure file system usage. More...

#include <FileHelperRK.h>

Public Member Functions

int measure (const char *path, bool clearStats=true)
 Measure disk usage for a directory and its subdirectories and files.
 
void clear ()
 Clear the measurement stats.
 
String toString () const
 Return a readable representation of this class.
 

Data Fields

size_t fileBytes = 0
 Number of bytes total for all files.
 
size_t sectors = 0
 Number of sectors used.
 
size_t numFiles = 0
 Number of files.
 
size_t numDirectories = 0
 Number of directories.
 

Detailed Description

Measure file system usage.

Member Function Documentation

◆ measure()

int FileHelperRK::Usage::measure ( const char * path,
bool clearStats = true )

Measure disk usage for a directory and its subdirectories and files.

Parameters
pathc-string containing an absolute or relative Unix-style pathname (slash separated) to a file or directory
clearStatsCall clear() to reset stats
Returns
int SYSTEM_ERROR_NONE (0) on success or a system error code (non-zero)

◆ toString()

String FileHelperRK::Usage::toString ( ) const

Return a readable representation of this class.

Returns
String

Field Documentation

◆ fileBytes

size_t FileHelperRK::Usage::fileBytes = 0

Number of bytes total for all files.

This is a sum of the file sizes, not the usage on disk.

◆ sectors

size_t FileHelperRK::Usage::sectors = 0

Number of sectors used.

Each sector is sectorSize bytes. Each file takes one sector for metadata plus enough sectors to hold all of the data. Each directory takes one sector. sectorSize is 4096.

This is an approximate value and may vary from the actual usage.


The documentation for this class was generated from the following files: