Skip to content

Instantly share code, notes, and snippets.

@iOnline247
Created March 28, 2015 18:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iOnline247/7d880e2cea73f71ce9b1 to your computer and use it in GitHub Desktop.
Save iOnline247/7d880e2cea73f71ce9b1 to your computer and use it in GitHub Desktop.
Create 21,000 folders and 21,000 files for funsies
# Create 21,000 folders and 21,000 txt files.
# Add one file per folder.
# Folder names will be sequential.
# File names will start with a GUID and end with a timestamp.
# This is to try and prove if ODB is FIFO and not any other way.
param(
[parameter(mandatory=$true)]
[string]$filePath
)
$numOfIterations = 0
# Clean directory
Get-ChildItem -Path $filePath -Recurse | Remove-Item -Recurse -Confirm:$true
while($numOfIterations++ -lt 21000) {
$guid = [guid]::NewGuid()
$tick = (Get-Date).Ticks
$currentPrefix = $($guid.ToString() + '#;' + $tick)
$folderPath = "$($filePath)" + "\" + "$($numOfIterations)"
# Create folder.
md -Path $folderPath -Force
# Create file.
[guid]::NewGuid().ToString() | Out-File $($filePath + "\" + $currentPrefix + ".txt") -Force
}
# Sort files based on numeric sort.
# $arrayOfStrings | Sort-Object { $_.substring($_.lastIndexOf("#;") +2) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment