|
|

Available Now

Search

Contact
Feedback:
Send an e-mail with your
comments about this program (or anything else).

Help support DFF
If you benefit from the website, in terms of
knowledge, entertainment value, or something otherwise useful,
consider making a donation via PayPal to help defray the
costs. (No PayPal account necessary to donate via credit
card.) Transaction is secure.


|
| |
It is occasionally useful to look a
the largest files on a drive while doing housecleaning chores.
Here's a program that will display a sorted list of a specified number of
the largest files on a user selected hard drive regardless of the folder structure.
For programmers, items of potential
interest include:
 |
A GetFiles procedure that recursively searches folders on a drive and
builds a stringlist of all files. The list is then sorted by size
and the specified number of files names displayed along with size information.
|
 |
When the use clicks on a file, a ShellExecute call is made to start
Explorer.exe to display the containing folder with the clicked file
pre-selected.
|
 |
A call is first made to
GetWindowsDirectory to ensure that we can locate Explorer.exe.
|
 |
A couple of Format usage
tricks that it took me a while to learn:
 |
leading zeroes zeroes in a format
string for use the precision field, so '%.10d' pads an integer
field to 10 characters with leading zeroes.
|
 |
There is no integer format specifier
that will insert comma punctuation so we convert integers to floating point and
use the %n format specifier. Format('%14.0n',[size+0.0]);
will display file sizes up to 99,999,999,999 bytes with embedded
commas and leading blanks. |
|
Addendum April 30, 2007:
Colin K. just reported that file sizes for very large files (greater than
maximum 32 bit integer size, about 2.1GB) caused the
program to abort. It turns out that Borland changed the file size field to
64 bit integer sometime after Delphi 5 so large files compiled with a late
version can have the abort problem. For the version I use, D5, the program
just reported negative file sizes in those cases. It turns out that even
in D5, the full size is available by combining two 32 bit integer fields
from an extension area of the file information record. That fix was applied
today. As usual when revisiting a program, I made a few other
changes.
 |
The file search is now about
twice as fast as the original version. |
 |
The results can now be copied and
pasted elsewhere, to a text file for printing foe example. |
 |
Scan time and number of file
sizes checked is now displayed. |
Running/Exploring the Program
Download Source
Download Executable
| Created: October 19, 2002 |
Modified:
April 30, 2007 |
|