Every once in a while, you end up on a friend's computer and you think to yourself, what is the most annoying thing I can do RIGHT NOW. Well don't even worry, here is a super quick way to make some gigantic files. Of course, it starts with opening up PowerShell. (You can do the same thing on a Unix machine with 'cat'). Ok let's do it.


'a' * 1000 > temp.txt
Get-Content temp.txt >> temp.txt

  1. Writes the letter 'a' to a file named temp.txt 1000 times.
  2. Reads temp.txt line by line, and appends it to the end of temp.txt

Pretty simple right!? Just a never ending loop of file writing. You can event do it in a single line.


'a' * 1000 > temp.txt; gc temp.txt >> temp.txt

The real question is, how fast does this baby go. So here we go, a test which lets this run for 30 seconds, then kills it.


$job = Start-Job -ScriptBlock {'a' * 1000 > temp.txt; Get-Content temp.txt >> temp.txt}
Wait-Job -Job $job -Timeout 30
Stop-Job -Job $job

This made me a nice 1.4GB text file. Also tried for 120 seconds, and ended up with a 5.2GB file. So there you have it. Fun time with files.