-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
48 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
function Assert-PsOneFolderExists | ||
{ | ||
<# | ||
.SYNOPSIS | ||
Makes sure the specified folder(s) exist | ||
.DESCRIPTION | ||
If a folder does not exist, it will be created. | ||
.EXAMPLE | ||
($Path = 'C:\test') | Assert-PsOneFolderExists | ||
Makes sure the folder c:\test exists. If it is still missing, it will be created. | ||
.EXAMPLE | ||
'C:\test','c:\test2' | Assert-PsOneFolderExists | ||
Makes sure the folders. If a folder is still missing, it will be created. | ||
.EXAMPLE | ||
Assert-PsOneFolderExists -Path 'C:\test','c:\test2' | ||
Makes sure the folders. If a folder is still missing, it will be created. | ||
.LINK | ||
https://powershell.one | ||
#> | ||
|
||
|
||
param | ||
( | ||
[Parameter(Mandatory,HelpMessage='Path to folder that must exist',ValueFromPipeline)] | ||
[string[]] | ||
$Path | ||
) | ||
|
||
process | ||
{ | ||
foreach($_ in $Path) | ||
{ | ||
$exists = Test-Path -Path $_ -PathType Container | ||
if (!$exists) { | ||
Write-Warning -Message "$_ did not exist. Folder created." | ||
$null = New-Item -Path $_ -ItemType Directory | ||
} | ||
} | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters