Copyright: Visual Help Copyright® 1993 Firas Bushnaq


Tfileinfo Component

Properties

Description

The Tfileinfo component is a control designed to simplify recursive file handling procedures.  The control has one published property - Path.
All other properties are read only and supply such information as number of directories, number of files in a directory, etc.  Refer to properties for a detailed description.

Using the Tfileinfo component

To use the Tfileinfo component, simply supply the path and then query the control for the result.

Example:

fileinfo1.path := 'c:\';
totalbytes := fileinfo.Filebytes;

The above example finds the total size of all files in the root directory.


Tfileinfo component properties

FileBytes

Filebytesbeneath

Numfiles

Numfilesbeneath

Numdirsbeneath

Numtopleveldirs

Thisdisksize


Filebytes

Component

Tfileinfo

Example:

fileinfo1.path := 'c:\windows';
totalbytes := fileinfo.Filebytes;

The above example finds the total size of all files in the directory 'c:\windows'.


Filebytesbeneath

Component

Tfileinfo

Example:

fileinfo1.path := 'c:\delphi';
totalbytes := fileinfo.Filebytesbeneath;

The above example finds the total size of all files in the directory 'c:\delphi' and all subdirectories including subdirectories of subdirectories.
Note that if a path of 'c:\' was specified, the control would return the size of all files on the disk.


Numfiles

Component

Tfileinfo

Example:

fileinfo1.path := 'c:\';
totalfiles := fileinfo.Numfiles;

The above example finds the number files in the root directory.  The number of files returned does not include any directory entries.

Special Note:

This property is dependent of the filebytes property.  First read the filebytes property and then read the numfiles property.


Numfilesbeneath

Component

Tfileinfo

Example:

fileinfo1.path := 'c:\delphi';
totalfiles := fileinfo.Numfilesbeneath;

The above example finds the number of files in the delphi directory and all its subdirectories.  The number of files returned does not include any directory entries.


Numdirsbeneath

Component

Tfileinfo

Example:

fileinfo1.path := 'c:\delphi';
totaldirs := fileinfo.Numdirsbeneath;

The above example finds the number of directories in the delphi directory and all its subdirectories.


Numtopleveldirs

Component

Tfileinfo

Example:

fileinfo1.path := 'c:\';
totaltops := fileinfo.Numtopleveldirs;

The above example finds the number of top level directories on drive c:.  Note that the result is the same even if a path is given of say 'c:\windows';
This properties only returns the number of top level directories of the drive letter included in the path given.


Thisdisksize

Component

Tfileinfo

Example:

fileinfo.path := 'c:\';
size := fileinfo.thisdisksize;

This example returns the size of drive c:.


prop_filebytes


prop_numfiles