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:
For /L %i in (1,1,25000) do fsutil file createnew A%i.tmp 12288
will create 25,000 files of 12288 bytes (12KB) named A1.tmp, A2.tmp, A3,tmp…
to run this loop in a .cmd file instead of from the command line replace single % with double percent signs
For /L %i in (1,1,10000) do fsutil file createnew B%i.tmp 65536
will create 10,000 files of 65536 bytes (64KB) named B1.tmp, B2.tmp, B3,tmp…
For /L %i in (1,1,2500) do fsutil file createnew C%i.tmp 131072
will create 2,500 files of 131072 bytes (128KB) named C1.tmp, C2.tmp, C3,tmp…
For /L %i in (1,1,1000) do fsutil file createnew D%i.tmp 1048576
will create 1,000 files of 1048576 bytes (1024KB or 1MB) named D1.tmp, D2.tmp, D3,tmp…
I was able to create hundreds of thousands of files of a very specific size in a short amount of time using this procedure.