Creating Large Dummy Testing Files

In recent project I created the custom file uploader webpart. When it was time to test it, first thing was looking for some huge file.

At first I applied the simple logic using MS Word Lorem Macro trick. wooo I created 14000 pages but file size was just 3 MB. What !!! ?

That was surprise.

In end rescue was using power shell.

¬†$path = “$env:temp\testfile.txt”
$file = [io.file]::Create($path)
$file.SetLength(1gb)
$file.Close()
Get-Item $path
This created the 1GB test.txt file in my temp directory.
Advertisements

« Older entries Newer entries »