The other day I needed to do some testing with files of a very specific size. I was on a Windows PC that day, so I needed to find a tool that would work on a windows machine. I originally had thought to give it a spin in Python or Perl, but before I got my hands too wet I found a built in program in Windows XP and later versions that would quickly and easily do this for me.
Here is the command format:
“fsutil file createnew <fullpathtofile> <sizeinbytes>”
So, if you wanted to create a 100 kb file named “myfile.txt” in “c:\mytestfiles”, your command would look like this:
“fsutil file createnew c:\mytestfiles\myfile.txt 100000”
This creates a file of exactly 100kb at the location you specify. Really quite a handy tool to have around.