I'm trying to create directories at some target location, if they don't exist.
The name of the directory is from another source-location.
for each directory name in C:\some\location
create a new directory of the same name in C:\another\location.
for example.
c:\some\location\
\apples
\oranges
to
c:\another\location\
\apples
\oranges
so in effect i'm recreating all the folders from source -> to -> target.
NOT recursive, btw. just top level.
So i've got this so far with PS:
dir -Directory | New-Item -ItemType Directory -Path (Join-Path "C:\jussy-test\" Select-Object Name)
or
dir -Directory | New-Item -ItemType Directory -Path "C:\new-target-location\" + Select-Object Name
and i'm stuck. I'm trying to get that last bit right. but anways, maybe someone has a nicer idea in their head?
dir -Path C:\some\location\* -Directory | % { New-Item -ItemType Directory -Path C:\another\location\ -Name $_.Name }