List large files

[Home]   [Projects]    [Delphi Techniques]   [Math Topics]   [Library]   [Utilities]

 

Available Now

bullet

All Programs
bulletPuzzles & Projects
bulletDelphi Techniques
bulletMath Topics
bulletUtilities
bulletLibrary Units

Search

Google
 

Search WWW             

Search delphiforfun.org

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.

 

Google
 

Search WWW

Search delphiforfun.org

 

 

 

 

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:

 

bullet

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.   

bullet

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.     

bullet

A call is first made to GetWindowsDirectory to ensure that we can locate Explorer.exe

bullet

A couple of Format usage tricks that it took me a while to learn:

bullet

leading zeroes zeroes in a format string for use the precision field, so '%.10d'  pads an integer field to 10 characters with leading zeroes.

bullet

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. 

 

bullet

The file search is now about twice as fast as the original version.

bullet

The results can now be copied and pasted elsewhere, to a text file for printing foe example.

bullet

Scan time and number of file sizes checked is now displayed.    

 

Addendum November 10, 2008:  At a user's request, Version 3 was posted today which adds "last Modified Date" to the displayed information.  A new button was also added which saves the list of large files as a Comma Separated Value, CSV, file.   It is simple to import this file into Excel where it can  easily be re-sorted by date stamp or filename.

 

Running/Exploring the Program 

 

Download Source

Download Executable

 

Created: October 19, 2002

Modified: November 11, 2008

 

  [Feedback]   [Newsletters (subscribe/view)] [About me]
Copyright © 2000-2008, Gary Darby    All rights reserved.