Howto: Generate many files of a particular size in Windows

by admin on January 16, 2009

I was recently performing some performance testing that required me to copy many files of a particular size from one Windows XP workstation to a Windows 2003 server. I had a heck of a time figuring out how to batch generate the test files.

Finally I cam across the fsutil tool, which is included on both Windows XP and Windows Server 2003.

The syntax for using fsutil is:

fsutil file createnew filename filesize

I used a simple loop to create files of a particular size using fsutil. Running from a command prompt:

This is a good approach, that helped me in practice! I needed a file generator, and I’ve been using your solution for a while.
But the local peculiarity of is that it creates binary files filled up with zeros. That’s a disadvantage for benchmarking, cos fsutil cannot simulate a real-world environment.
I’ve just implemented a filegen.exe, which generates random files.