Generating large test/data files
Sometimes we may need to generate large files on disk to simulate usage for example. And it may not matter what that test file contains (or doesn't contain).
You can use one of the fsutil utility commands in Windows in such cases to generate such dummy files.
Mind you the file will be sparse. So when you open the file in notepad, there will be nothing in it :)
C:\> fsutil file createnew C:\TestDta\1mb.text 1048576
The last but one parameter above is the path to file which we intend to create.
The last parameter is the size of desired file in bytes, so you can put any number there as log as it fits on your drive.
Some size conversions here for quick reference:
1 MB = 1048576 bytes
100 MB = 104857600 bytes
1 GB = 1073741824 bytes
10 GB = 10737418240 bytes
Creating dummy files with text
There is a nice trick for generating large files with pre input text.
You can first create a text file with some input text. Then you run a loop to append the file to itself 'n' number of times (this will essentially double the file size i.e. it will grow 2^n)
For example, to create a test file of size approximately 1MB you can run below commands one after another:
echo "My sample text to generate a large file. " > Test.txt
for /L %x in (1,1,14) do type Test.txt >> Test.txt
The file size may not be exact however, as it depends on initial text that we are doubling every time. Generate the files and check if the resulted size is acceptable.
Hope it helped.