I have a CSV file that includes custoomers informations, from it I'm able to create folders for each customers using the below script :
$Names = Import-Csv -Path “$PSScriptRoot\Info.csv” | Select-Object customer, info Set-Location -Path "$PSScriptRoot\Collection" foreach($customer in $Names) { $CustomerPath = '{0}{1}' -f $Customer.customer, $Customer.Info if (Test-Path -Path .\$CustomerPath) { $Message = '{0}{1} {2} exists' -f "`t", $Customer.Client, $Customer.Info Write-Message -Message $Message -ForegroundColor Green } else { $null = mkdir $CustomerPath $Message = '{0}{1} {2} created' -f "`t", $Customer.Client, $Customer.Info Write-Host -Message $Message -ForegroundColor Green }}
My issues is that I'm not able to create subdirectories for each customers.in other work I need to create some other folders into each customer folders that will receive files collections, for example CSV files [other data], excel files and so on...
structure should be :
customerFolder | CSV folder ESXCEL Folder DOC Folder
I already tried to modify my script above in order to create sub-directories without success.as also I'm trying to use test-path in order to avoid to create the same folders.