Script to create the folder structure used in broadband
This commit is contained in:
56
Make-FolderStruct.ps1
Normal file
56
Make-FolderStruct.ps1
Normal file
@@ -0,0 +1,56 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
This script creates a folder structure under $FolderName
|
||||
|
||||
.DESCRIPTION
|
||||
This script creates a folder with a set of different sub-folders in it.
|
||||
The parent folder is created under the $Path defined.
|
||||
|
||||
.PARAMETER $Path
|
||||
The path where the main folder will be created.
|
||||
|
||||
.PARAMETER $FolderName
|
||||
The name of the parent folder. Default is "New Folder"
|
||||
|
||||
.EXAMPLE
|
||||
The example below creates the folder "Example" in the main drive.
|
||||
PS C:\> dir-maker -Path C:\
|
||||
|
||||
.NOTES
|
||||
Author: JQQ
|
||||
Last Edit: 2022-11-22
|
||||
Version 1.0 - initial release
|
||||
|
||||
#>
|
||||
|
||||
# Parameters
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
#Root Path
|
||||
[Parameter(Mandatory=$True)]
|
||||
[string]$Path,
|
||||
|
||||
#Parent Folder Name
|
||||
[string]$FolderName = "New Folder"
|
||||
);
|
||||
|
||||
# Variables
|
||||
[string]$ParentFolder = $Path + $FolderName;
|
||||
[string[]]$FolderList = @("\Alarms"
|
||||
,"\GFX"
|
||||
,"\Historian"
|
||||
,"\PLC"
|
||||
,"\Simulation"
|
||||
);
|
||||
|
||||
# Main
|
||||
Write-Verbose("Creating parent folder " + $ParentFolder);
|
||||
ForEach ($Folder in $FolderList) {
|
||||
New-Item -Path ($ParentFolder + $Folder) -ItemType Directory;
|
||||
};
|
||||
|
||||
<#
|
||||
.NAME
|
||||
Make-Structure
|
||||
|
||||
#>
|
||||
Reference in New Issue
Block a user