-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgeneratedirs.ps1
More file actions
64 lines (45 loc) · 1.25 KB
/
generatedirs.ps1
File metadata and controls
64 lines (45 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Param(
[string]$VolumeName=""
)
$chars = [char[]] ([char]'0'..[char]'9' + [char]'a'..[char]'z')
$chars = $chars * 30
$targetratio = (get-random -min 2 -max 8)/10
Write-Host "Target ratio ", $targetratio
function GetFreeRatio
{
$volume = get-volume -DriveLetter $VolumeName
$ratio = $volume.SizeRemaining / $volume.Size
$ratio
}
function GenerateContent
{
$content = -join(Get-Random $chars -Count 512)
for($i=1; $i -lt 512; $i++)
{
$content = -join($content, -join( Get-Random $chars -Count 512))
}
$content
}
$content = GenerateContent
while( (GetFreeRatio) -gt $targetratio )
{
$order = get-random -min 3 -max 5
$min = [math]::pow(10,$order)
$max = [math]::pow(10,$order+1)
$cnt = get-random -min $min -max $max
$cnt = [math]::round($cnt)
$folder = -join(Get-Random $chars -Count (get-random -min 6 -max 48))
mkdir $folder
for ($i=1; $i -lt $cnt; $i++)
{
$file = -join(Get-Random $chars -Count (get-random -min 6 -max 48))
$file = $folder + "/" + $file
$size = (get-random -min 10 -max 1000)
$sizegb = ($size * $content.Length)/(1024*1024*1024)
Write-Host $sizegb, $file
for($i=1; $i -lt $size; $i++)
{
$content | Out-file -FilePath $file -Append
}
}
}