Create a subdirectory/subfolder Create a subdirectory/subfolder powershell powershell

Create a subdirectory/subfolder


New-Item -ItemType Directory -Path C:\NewPath\NewSubPath\AnotherSubDir\WowThisIsReallyNested -Force

That will create the full path, including all of the subdirectories.


This is what I wound up ending with:

# Compiles the Fusion packet for distribution##########################################Variables###########################################folder structure$FSG = "F:\FSG"$containerFolder = "Packet.Fusion for IT and AV Professionals"$rootFolder      = "Fusion for IT and AV pros $(Get-Date -format “MM-dd-yyyy”)"$subRoot1        = "Fusion Server"$subRoot2        = "Scheduling Enhancement and Panels"$subRoot2sub1    = "Scheduling Panels"$subRoot3        = "SQL Server"#source folders$HW      = "0.Hardware"$3SMDoc  = "0.Hardware\TPMC-3SM.Documentation"$4SMDoc  = "0.Hardware\TPMC-4SM.Documentation"$4SMDDoc = "0.Hardware\TPMC-4SM-FD.Documentation"$730Doc  = "0.Hardware\TSW-730.Documentation"$730OLH  = "0.Hardware\TSW-730.OLH"$CENRVS  = "0.Hardware\CEN-RVS.Notes"$ProjMgmt = "0.Project Management"$SW            = "0.Software"$RVLicensing   = "0.Software\0.RoomView.License"$RVNotes       = "0.Software\0.RoomView.Notes"$SQLLicensing  = "0.Software\database.SQL.Licensing"$SQLNotes      = "0.Software\database.SQL.Notes"$FRVMarketing  = "0.Software\Fusion RV.Marketing"$FRVNetworking = "0.Software\Fusion RV.Networking"$FRVNotes      = "0.Software\Fusion RV.Notes"################################create the directory structure###############################md -Path $containerFolder -Name $rootFoldercd $FSG\$containerFolder\$rootFoldermd "eControl and xPanels"md "Fusion Server" #$subRoot1md "Getting Started as a User"md "Project Management"md "RoomView Connected Displays"md "Scheduling Enhancement and Panels" #$subRoot2md "SQL Server" #$subRoot3cd $FSG\$containerFolder\$rootFolder\$subRoot1md "CEN-RVS"md "Licenseing Information"md "Networking"md "Official Documentation"md "Prerequisites, including powerShell script"md "Product Info"md "Requirements"md "Tech Info"md "Windows Authentication to Fusion RV"cd $FSG\$containerFolder\$rootFolder\$subRoot2md "Outlook Add-in"md "Scheduling Panels" #$subRoot2sub1cd $FSG\$containerFolder\$rootFolder\$subRoot2\$subRoot2sub1md "TPMC-3SM"md "TPMC-4SM"md "TPMC-4SM-FD"md "TSW-730"cd $FSG\$containerFolder\$rootFolder\$subRoot3md "Multi-database model only"md "SQL Licensing"