Test File Generator Version:

Member for

1 year 6 months
Submitted by AlReaud on Mon, 06/06/2011 - 08:55

NOTE 2016-09-21: This application is cobwebbed, and has only been tested in Microsoft® Windows XP. Users on later versions of Windows may find this application inoperable without modification. Please use with caution!

© 2004-2016 Alfred P. Reaud, Happy Cat Technologies

Table of Contents:

  1. Introduction.
  2. Changes.
  3. Algorithm.
  4. User Interface.
  5. Cautions.
  6. Prohibited Operations.
  7. Installation and Rebuilding.
  8. Known Bugs and Other.
  9. Download GNU-GPL licensed source code and executable.


This is the third minor release of the TestFileGenerator.  Developed in conjunction with FileCleanerPro as a freeware test file generation tool, it is intended for use in verification and debugging of applications that would operate on files.  Primarily for the Microsoft® Windows XP platform, TestFileGenerator simulates dat, cookie, gif, and html files in the Microsoft® Internet Explorer (IE) temporary internet file areas.  TestFileGenerator is also capable of generating random character files in a user-designated folder.  You may use it concurrently with IE, as it does not modify any files being used by IE, nor does it integrate into the visited web page database (please see the Known Bugs and Other Section for further information).

This author found the need, while developing FileCleanerPro, for a Windows application that generated test files without having to be on-line, browsing through numerous pages to get a sample test file set.  Browsing was inefficient, and unnecessarily consumed connection bandwidth, and sometimes the need for test files in a known folder arose.  The intent of TestFileGenerator is to address those needs, doing so with a user-friendly interface.


  1. Modified to operate with the Microsoft® Internet Explorer 7 file structure.
  2. Prioritized operation in Content.IE5, History.IE5, and Cookie folders.
  3. Corrected numerous bugs in temporary internet file processing.

  1. Changed the arbitrary constraint in the allowed number of files to be 131070.

  1. Initial release on the web.


The current generation of TestFileGenerator was developed using the wxDev-C++ IDE (Integrated Development Environment), and the FLTK (Fast Light Tool Kit) utility.  TestFileGenerator is a standalone program and does not require installation.

TestFileGenerator, with Find Temporary Internet Folders selected, recursively searches for the folders “Temporary Internet Files”, "History”, “Cookies”, “Content.IE5”, and “History.IE5”, starting from the folder “C:\Documents and Settings\<account name>” where <account name> is the current user name.  TestFileGenerator insures that no folder names are duplicated in the search, as in example, “Content.IE5” is a subfolder of “Temporary Internet Files".   TestFileGenerator also allows the user to select a designated folder and to select the number of files to be generated, their average size, their size spread around the average value, and depending on which mode is in use, the extension type of the files.

There are two modes of operating to TestFileGenerator:

  1. Create Files in Temporary Internet Folders.  This is the mode of operation used when the Find Temporary Internet Folders radio button is enabled.  It scans the folders where IE is known to have placed temporary files and generates test files in that area, spaced approximately evenly throughout the folders with special emphasis on sub-folders of Content.IE5 and History.IE5.
    TestFileGenerator generates HTML files, TestFilexxx.htm, and corresponding GIF files, TestFilexxx.gif, counted as two files, in folders corresponding to the places where IE places temporary internet files, i.e. sub-folders of Content.IE5.   xxx corresponds to the instant file count in the given folder when the file is written.  Opening the HTML file should show a valid HTML page with an imbeded image and a displayed creation time that matches the actual file creation time.  TestFileGenerator will also place simulated cookie files, TestFilexxx.txt in the places where IE places cookies, such as in the Cookies folders.  Finally, TestFileGenerator will place simulated data files, TestFilexxx.dat, in places where IE creates an index.dat or other binary data files.  This dat file is always a determinate 1638 bytes long, composed of random characters.
  2. Create Files in User-Designated Folder.  This is the mode of operation used when the Find Temporary Internet Folders radio button is disabled. TestFileGenerator creates random character files in the designated folder, using the rand() function to generate the contents of the new files, and to determine the actual deviation of that file from the average size.  It is highly recommended that you first use TestFileGenerator in this mode to insure compatibility with the operating system installed on your computer.

User Interface:

The user interface is straightforward.  Figure 1 shows the user interface as it appears on startup, user-designated folder mode, with the default entries in their respective input boxes.  Figure 2 shows the user interface after completion of a 100 file write to the folder “c:\test”, with the average file size set for 10000 ±5000 bytes.  This resulted in 100 random character files being generated in the folder, with the smallest being 5060 bytes and the largest being 14980 bytes.  The average size (computed in Excel) was 10295 bytes and the population standard deviation was 2624 bytes.

Figure 3 shows the same entries in the input boxes and Figure 2, however we now have the Find Temporary Internet Folders radio button enabled.  Please observe that some of the inputs are now disabled.  This is because they are not pertinent in temporary internet folders mode.  The only pertinent box is the count of files to generate.  Figure 4 appears the same, however, observe the command buttons.  Cancel and OK are disabled and ABORT is enabled.   In Figure 4, we are waiting for the user to press the Enter key or depress the OK button in Figure 5, which is an information window that pops to indicate to the user the general areas where the files where created and the counts in each area.  The plethora of files in the folder “Content.IE5” is due to there being 4 sub-folders to “Content.IE5” not including itself.  TestFileGenerator attempts to spread the files evenly among temporary internet folders, however it is not possible, in advance to know exactly the count that will occur in a given folder.  Also, as TestFileGenerator is actually writing two files for every htm file generated, the htm file itself and a gif file that corresponds to it, the spread of files will be skewed towards the sub-folders.

Test File Generator user interface on startup.
Figure 1

Test File generator user interface after processing in user-defined folder mode.Figure 2

Test File Generator in find temporary internet folder mode.
Figure 3

  Test File Generator in find temporary internet folder mode awaiting user entry after completion.
Figure 4

Test File Generator in find temporary internet folder mode post-creation information window.

Figure 5

  The user interface detailed description is as follows (all user inputs have tips associated with them):

  1. Find Temporary Internet Folders:  With this button depressed, TestFileGenerator will operate in the IE temporary Internet file area.  Depressing this button disables the Folder to use, File type to use, Average Size(B), and Size Spread(B) input boxes.  Releasing this radio button re-enables those input boxes.  If you don't depress this button then you must enter a valid folder name in the Folder to use text box or you will get a warning window.
  2. Folder to use:  An input text box for the name of the folder on which you wish to create the files in.  No Enter or Return is required.  However, valid Windows folder names are required, and testing is done to insure that the name is valid.  If the folder isn't present, a prompt window opens asking if you wish to create this folder.  Either use the mouse or the keyboard to respond.  Enter is equivalent to Yes, and space (the default, indicated by the dashed lines), indicates No.  Any syntactical errors in this dialog box will result in a warning window popping up explaining the error.  Further, certain folders are prohibited, discussed in the prohibited operations section.
  3. File type to use:  This text input box is for entry of a file extension.  Extensions are actually not required and it is provided for convenience.  It also simplifies viewing of the created files, as txt is associated with Microsoft® Notepad, doc is associated with Microsoft® Word, etc.  This text input box is disabled if Find Temporary Internet Folders is enabled.
  4. Count of files:  This is the count of files that TestFileGenerator is to create.  The minimum value of this numeric input box is one, and the maximum value is 131070.  Entries that exceed those limits will give a warning window and are automatically corrected to fit the corresponding minimum or maximum.  Entries that are decimal are allowed, however only the integer part of the entry is used. The file count limitation is arbitrary, and could be set to any amount up to the NTFS limit of 232-1.
  5. Average Size(B):  This is the average size in bytes of the files to be generated by TestFileGenerator.  The minimum value is 1000, and the maximum value is 1000000.  Entries that exceed those limits will give a warning window and are automatically corrected to fit the corresponding minimum or maximum.  Entries that are decimal are allowed, however only the integer part of the entry is used.  This numeric input box is disabled if Find Temporary Internet Folders is enabled.  As the actual file size is computed by the formula Average Size ±(rand()*Size Spread)), there will never be a determinate output file size unless Find Temporary Internet Folders is enabled.  However, the spread of file sizes should match a bell curve centered on Average Size.
  6. Size Spread(B)This is the maximum spread size in bytes of files created by TestFileGenerator while not in create files in temporary internet folders mode.  The minimum value is 250, and the maximum value is 250000.  Entries that exceed those limits will give a warning window and are automatically corrected to fit the corresponding minimum or maximum.  Entries that are decimal are allowed, however only the integer part of the entry is used.  This numeric input box is disabled if Find Temporary Internet Folders is enabled.  Any file created will be within the range of sizes Average Size ± Size Spread, it's actual size determined by two random number operations.   Further, Size Spread must be less that Average Size - 1, which is to prevent loop overflow happening because a loop counter was given a negative value.  Entries that violate this constraint will give a warning window and are automatically corrected to fit within the constraint.
  7. Progress:  This widget shows the progress of TestFileGenerator.  Its progress depends on the count of files, the options selected, the speed of your disk drive and computer, and on any system, disk, and processor resources consumed by other applications that are active at the same time.
  8. Cancel:  This button cancels TestFileGenerator, similar to the Window Close Window Close button image. button.  Use either to terminate the application.
  9. OK:  This button starts processing of the named folder or the temporary Internet file area respective of the input box values.  Depressing this button also disables all other user input except for the ABORT button.  However the Window Close, Window Close button image., and Window Iconize, Window Iconize button image., buttons are still active.
  10. ABORT:  This button aborts any processing that is currently occurring at the end of the current media write.  Depress this button immediately if you change your mind about creating files in the area TestFileGeneratoris is operating in.  This button also re-enables all user inputs except those listed in the Find Temporary Internet Folders radio button description, above, depending on it's state.  However, see the cautions section for further information.


Please be cautious with the use of TestFileGenerator .  Though this is a benign application, you may accidentally fill a folder with test files.  This will not hurt your computer or it's operation, but can be a mild nuisance to correct.  Hence the limitations on file counts, average file size, and file size spread.   Also be aware TestFileGenerator may fill a hard disk or removable media such as a flash drive with test files, and will easily fill a floppy disk with test files.  Assuming that you set the file count to 1000, the average size to 1000000 bytes, and the size spread to 250000 bytes, this will result in a total character count ranging from 750,000,000 (750MB) to 1,250,000,000 (1.25GB) bytes.  While checking for available space does occur, that won't prevent that available space from being filled up if there is enough to process the configuration you entered in the numeric input boxes.

This author doesn't recommend that you use TestFileGenerator on CD-R, CD-RW, or DVD drives as they have not been tested.  Pass-thru operation may not work, or many not work as advertised on optical media drives that allow pass-thru, as TestFileGenerator uses low level forced flushing to the media which may not be compatible with a pass-thru optical drive.  Further, this author is not and will not be responsible for careless, negligent, and/or malignant use by any individual who uses TestFileGenerator.  Please see the GNU General Public License for more details.

Also, please be aware that TestFileGenerator does not operate on read-only or locked files.  Please be aware that TestFileGenerator, while in create files in temporary internet folders mode, only operates on folders used by Microsoft® Internet Explorer (IE), and does not operate on folders used by other Internet browsers, such as Mozilla, Opera, etc., unless they use the same folders as IE.  Finally, with the above two paragraphs in mind, please be sure that you actually want to do what you configured TestFileGenerator to do before you press that OK button!

Prohibited Operations:

With the cautions section in mind, certain files and folders where prohibited from being used, as follows:

  1. The folders “C:\”, and any folders containing the text "drivers”,  "system”, “windows”, “winnt”, “documents and settings”, and “program files” are prohibited from being used as targets for operation.  This is for obvious reasons, dealing with system security.
  2. TestFileGenerator will not use folders that contain the text “sys” or "admin”, in a case insensitive sense.  Again, this is for obvious reasons.
  3. No temporary Internet folders are bypassed, other than the one listed below, as intelligent folder search has been implemented.  This allows for further utility among systems that do not use standard folder naming.  However, if you don't have ownership of the folder in question, TestFileGenerator will not create files in it.
  4. The folder “Content.MSO” is bypassed as it contains Microsoft® System Objects such as Windows Media Files that are needed by certain Windows applications.

Installation and Rebuilding:

This application may be installed in any folder.  To install, extract TestFileGenerator.exe from TestFileGenerator_1.1.0.0-20081003.zip to the folder of your choice.  "C:\Windows” is the recommended location for Windows applications.  You can then create a shortcut to it by right clicking on the Desktop and selecting New -> Short Cut to create a desktop shortcut to TestFileGenerator. 

A good way to test the operation of this software on your system is to create 100 files in a nonexistent user-designated folder, with an extension of txt, rtf, or doc.  Insure that 100 files where created and that the size spread matches what you entered.  If you're exhibiting a need for TestFileGenerator then you already know how to code and are familiar with advanced user concepts, so I won't get into the use of grep, od, wc, and other useful Linux/Unix commands that have ported over to the Windows operating system.

Rebuilding TestFileGenerator requires a C++ compiler such as Dev-C++ or Code::Blocks (freeware),  Microsoft® Visual C++ 2010 Express ($109USD from MSDN) or any other compatible C++ compiler.  The only caveat is that it must accept FLTK include files and libraries.  All necessary TestFileGenerator source and header files are included in TestFileGenerator_1.1.0.0-20081003.zip.  The author recommends that if you are using Dev-C++ that you extract the TestFileGenerator source files to a folder in the same location as devcpp.exe.  Regardless, I also recommend that you extract the all the source files to their own project folder for ease of use and visibility.

If you are using Dev-C++, you will need to reconfigure the Project Options -> Parameters -> Linker to point to the correct locations of the required library files.  If you followed the recommendation on where to place the files in the preceding paragraph, then it's a simple matter to change the text "../Dev-Cpp” to “../” which points the compiler to the correct required library location.  One would think that the compiler could figure this out, but Dev-C++ doesn't, for whatever reason.  The required library files are listed at the top of the header file TestFileGenerator.h, with the required header files following thereafter.  This author did not use Visual C++, and therefore cannot comment on whether it will compile correctly on it.  TestFileGenerator has been designed using standard C++ header files and run time libraries, so it should be straightforward to rebuild TestFileGenerator using Visual C++.  However, the author of TestFileGenerator can't guarantee that!

This author would recommend that Linux/Unix users not attempt to use TestFileGenerator, as it's designed with Windows XP in mind.  However, with some work, it you should be able to implement TestFileGenerator in any operating system.

TestFileGenerator has been verified on the following operating systems and machines:

  1. Windows XP Professional Version 5.1.2600 Service Pack 3 Build 2600
    1. Compaq Presario.

Known Bugs and Other:

Currently, TestFileGenerator does not work correctly with Create Files in Temporary Internet Folders mode. This is due to changes in Internet Explorer 7.0 since the original release for Internet Explorer 5. Corrections to this and implementation of browsers other than Internet Explorer will be done in the next revision of this application.

If you find any other bugs, please contact the author.  Also, if you wish to see this application updated for previous versions of Microsoft® Windows, or any other browser for that matter, please contact me with the pathnames of the proper temporary Internet file folders, and I'll modify the software to suit that operating system or browser version.

Download GNU-GPL Licensed Source Code and Executable.

Requires WinZip 8.0® or preferably a compatible un-zipper such as 7-Zip.

Download TestFileGenerator_1.1.0.0-20081003.zip now (266KB).   7-Zip V4.23 CRC for TestFileGenerator.exe is D2732666.

TestFileGenerator has 225 lines of code and took approximately 65 hours to develop.  Hopefully, you found or will find TestFileGenerator useful.  If you did, then a small voluntary donation would be appreciated to defray the costs of hosting a happycattech.com and for the hours expended developing TestFileGenerator.

Add new comment

The content of this field is kept private and will not be shown publicly.

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol type start> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id> <u> <s> <sup> <sub> <hr>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.
Enter the characters shown in the image.