FileGen is a command-line program to create test files of different lengths.
FileGen takes 2 or 3 parameters: filegen file size [byte]
- filegen test 1000
this will create a file named test and 1000 bytes long, the bytes are random
- filegen test 1000 0
this will create a file named test and 1000 bytes long, and all the bytes will be zero
The size and byte can be specified in hexadecimal notation, like this:
filegen test 0x100 0xA0
When you create a random byte sequence, C’s pseudo random number generation function rand is seeded with the current time (srand(time(NULL))). This means that the generated byte sequence is different each time you run the command.
The algorithm is not optimized for speed.
FileGen doesn’t test if the generated file already exists, it will be overwritten without warning. And it will not test if you have the required disk space to create the file.
Generating a 1.000.000.000 bytes long random file takes 95 seconds on my 2GHz machine.
Compiled with Borland’s free C++ 5.5 compiler.