Click here to Skip to main content
Licence Ms-PL
First Posted 4 Feb 2003
Views 69,704
Bookmarked 20 times

Make-A-File - File Creation Utility

Utility to easily create files for testing purposes. Also supports creating really huge files.

Sample Image - Make-a-File.jpg

Introduction

Often we need test files during development, either to see how an application behaves with differently sized files or just as a "payload" for various tests.

The Make-A-File utility is written just for this purpose - to create files. They can be between 1 byte and 18 Eb (Exabytes, thats about 18.432.000.000.000.000.000 bytes) filled with garbage, random values or zeroes.

Usage

Choose a filename (type or click on the "..." button) and a size. The size is made up by the number in the size field and a unit from the dropdown list. The dropdown list offers Bytes, Kb, Mb, Gb, Tb, Pb and Eb (each being a 1000 times bigger than the previous). The resulting file size in bytes is shown in the field at the bottom.

The checkbox "Random content" fills the file with, who would have guessed this, random bytes. The "Quick Create" checkbox is used to create a file quick and filled with garbage. Technically it uses SetFilePointer() to set the end of the file, which results in nothing being written to the file but allocates the disk space for its contents.

Please see the MSDN for the implications.

By default, the quick create also checks the random content.

If you are using NTFS with file compression enabled, you can easily create a 10 Tb (or even bigger) file on any hard disk if you do not enable the random content or quick create options.

How this works?

Simple, if none of these options is enabled then the program will write a stream of zeroes to the disk which get compressed to literally nothing on the file system. Any file which contains only all the same bytes allocates only one unit for the directory entry.

Information

It is written with MFC under VC6 und is tested under W2k and XP Pro (but should run on any Win32 plattform). The archive contains a release executable and the source code.

License

This article, along with any associated source code and files, is licensed under The Microsoft Public License (Ms-PL)

About the Author

Andreas Saurwein Franci Gonçalves

CEO
Uniwares Ltda.
Brazil Brazil

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
Generalbugs PinmemberSatelit0:16 21 Nov '07  
GeneralRe: bugs PinmemberAndreas Saurwein Franci Gonalves0:43 21 Nov '07  
GeneralJust what I needed! PinmemberAshtray3608:48 27 Aug '07  
Generaltimer Pinmemberkrathouse9:42 18 Apr '07  
GeneralGreat for creating files for unit testing a download utility! PinmemberJust3Ws7:02 6 Jul '05  
GeneralGreat PinmemberFlorent Geffroy22:00 21 Feb '05  
GeneralGreat tool Pinmemberomegamsx1:37 8 Feb '05  
GeneralHandy... PinmemberJoel Holdsworth3:25 21 Sep '04  
QuestionIt seems to crash when making a 12-Exabyte file :-( ?? PinmemberNitron15:48 5 Feb '03  
AnswerRe: It seems to crash when making a 12-Exabyte file :-( ?? PinmemberAndreas Saurwein23:32 5 Feb '03  
QuestionWhat's your goal? PinmemberA. Riazi1:52 5 Feb '03  
AnswerRe: What's your goal? PinmemberAndreas Saurwein1:56 5 Feb '03  
GeneralRe: What's your goal? PinmemberRoger Allen6:40 5 Feb '03  
GeneralRe: What's your goal? PinmemberAndreas Saurwein10:09 5 Feb '03  
GeneralRe: What's your goal? PinmemberJörgen Sigvardsson9:51 5 Feb '03  
GeneralRe: What's your goal? PinmemberAndreas Saurwein10:07 5 Feb '03  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web04 | 2.5.120517.1 | Last Updated 5 Feb 2003
Article Copyright 2003 by Andreas Saurwein Franci Gonçalves
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid