In many cases, systems engineers require to setup a system where in they need to automatically create a file and folder structure. Here is a simple code that serves such a need:
$Folder = "D:TEMP"
$UserName = “TestUser009”
$FileName = "ReadMe.txt"
$Path = $Folder + ” + $UserName
if (!(Test-Path -path $Path)){
new-item -path $Folder -name $UserName -type directory
}
if (!(Test-Path -path "$Path$FileName")){
new-item -path $Path -name $FileName -type file
}