Does anyone have a way to generate files of random data in Windows? I would like to generate 50,000 small (2K) files as an example.
Well, technically you could write something to do this for you.
I don't know of anything specific.. but the easiest way would be to create a TEXT file of a specific size (2K for example).. then write a batch file to copy it 50000 times.
You'll have to create files in the normal way, and then populate them with randomized data, probably from a rand() function of some sort.
It really depends on your programming language. Windows itself certainly won't provide this capability.
There are a number of programming languages that could do this easily, however, including basic windows batch/CMD scripts. What language are you interested in using?
You can run fsutil in a batch loop to create files of any size.
fsutil file createnew filename.extension 2000
Since you don't specify a language, I'll simply pick one at random. Here is a powershell script to do it:
$rootDir = 'C:\Temp\TestRandomFiles\'
$baseFile = $rootDir + "base.txt"
$desiredFileSize = 2*1KB
$fileCount = 50000
"start" | Out-File -Filepath $baseFile
While ($(Get-ChildItem -path $baseFile).Length -lt $desiredFileSize)
{
$(Get-ChildItem -path $baseFile).Length | Out-File $baseFile -APPEND
}
for($i=1;$i -lt $fileCount;$i++)
{
Copy-Item $baseFile "File$i.txt"
}
You'll have to change the variables to the parameters that you want of course.
I have been using Random Data File Creator and liking it, it creates binary files, ie not text files filled with pseudo-random bits, it can quickly create very large files. To use it to create multiple small files you would need to script it, which would be very easy given it is command line.