Hi,
I’m working on copying data from one AD to another and among the tasks is to organize and prepopulate empty folder structures preconfigured with correct permissions as well.
I know that I can use the New-Item -ItemType Directory -Force -Path 'Directory\SubDirectory\SubSubDirectory'
to recursively create an entire straight path, but if I need to create more than one Subdirectory or SubSubDirectory in each TopDirectory I’m feeling a bit lost.
In Linux the mkdir command supports brace expansion so you could for instance do this:
mkdir -p Directory\SubDirectory-{HR,Sales,Purchasing}\SubSubDirectory{1..3}
allowing me to simultaneously create three Subdirectories for different departments with each containing three numbered SubSubDirectories.
I’m getting information about the folder structure in Excel-files.
Example of structure:
Department
|_HR
|_Managers
|_Staffing
|_Sales
|_Managers
|_SalesStaff
|_Economy
|_Purchasing
|_Managers
|_Vendors
|_Microsoft
|_Apple
|_Samsung
|_Economy
As you can see each level contains unique values, so I can’t rely on simple numbering or similar.
I’ve previously built a script for creating a template for POSH modules using a relatively simple foreach, but that reuses the same structure everytime except for the TopDirectory Name, so it feels like it doesn’t match up to this.