List large files

[Home]   [Puzzles & Projects]    [Delphi Techniques]   [Math topics]   [Library]   [Utilities]

 

Search

Search WWW

Search DelphiForFun.org

As of October, 2016, Embarcadero is offering a free release of Delphi (Delphi 10.1 Berlin Starter Edition ).     There are a few restrictions, but it is a welcome step toward making more programmers aware of the joys of Delphi.  They do say "Offer may be withdrawn at any time", so don't delay if you want to check it out.  Please use the feedback link to let me know if the link stops working.

 

Support DFF - Shop

 If you shop at Amazon anyway,  consider using this link. We receive a few cents from each purchase.   Thanks.


Support DFF - Donate

 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.

Contact

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

Search DelphiForFun.org only

 

 

 

 

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.

 

Addendum February 10, 2009:  One of the last  two updates seems to have broken some of the features of the program.  Namely file name data was incomplete when clicking a file to open its folder, and when formatting to create the CSV (Comma Separated Values) file.   In any event, Version 3.1 posted today seems to have fixed those problems, hopefully without introducing any new ones J

 

August 16, 2011:  If reporting of file sizes greater than 4 GB ever worked, it got broken somewhere along the line.  That got fixed today with version 3.3. 

 

Running/Exploring the Program 

 

Download Source

Download Executable

 

Created: October 19, 2002

Modified: February 18, 2016

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