I am attempting to read all folder names from one directory (that part works) and to create a folder in a different directory with the foldername. So if C:\Folder1 has a folder named Testing then I want to create the directory R:\CopiedFromC\Testing
I get an error of New-Item : A positional parameter cannot be found that accepts argument '+'. each time my script tries to create the folder. This is my syntax
$items = Get-ChildItem -Path "C:\Folder1" foreach ($item in $items) { if ($item.Attributes -eq "Directory") { New-Item -ItemType directory -Path R:\CopiedFromC\ + $item } }