Reputation: 1
So,I will try to explain this as much as I can. Ive tried to create a simple code which will create various folders regarding 3 parameters
I can say that I have the last step...but I dont have idea how to create the rest. Please see the notepad description below..and also what Ive done so far.
param (
$path = "C:\test",
$M = 5,
$N = 2)
for ($i = 0; $i -lt $M; $i++)
{ $name = (New-Guid).guid
New-Item -ItemType Directory -path $path -name $name -force
}
Thanks for the ideas !
Upvotes: 0
Views: 40
Reputation: 174515
You never change the value of $path
, so all the new directories will be created under the same root folder.
param (
$path = "C:\test",
$M = 5,
$N = 2
)
$folder = Get-Item $path
for ($i = 0; $i -lt $M; $i++)
{
$name = (New-Guid).Guid
$folder = New-Item -ItemType Directory -LiteralPath $folder.FullName -Name $name -Force
}
# create your $N folders in the final (current) $folder here
Upvotes: 0