Skip to content

Commit

Permalink
v2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiasPSP committed Apr 23, 2020
1 parent 6d4cae7 commit 635fc55
Show file tree
Hide file tree
Showing 21 changed files with 48 additions and 2 deletions.
45 changes: 45 additions & 0 deletions PSOneTools/2.4/Assert-PsOneFolderExists.ps1
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.
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
$BufferSize = 32KB,

[Security.Cryptography.HashAlgorithmName]
[ValidateSet('MD5','SHA1','SHA256','SHA384','SHA512')]
# hash algorithm to use. The fastest algorithm is SHA1. MD5 is second best
# in terms of speed. Slower algorithms provide more secure hashes with a
# lesser chance of duplicates with different content
Expand Down Expand Up @@ -140,7 +141,6 @@
# or whether initializing the hash engine in the begin() block is safe.
try
{
$algorithmName = [Security.Cryptography.HashAlgorithmName]::SHA1
$algorithm = [Security.Cryptography.HashAlgorithm]::Create($algorithmName)
}
catch
Expand Down Expand Up @@ -250,4 +250,4 @@
# return result for the file
return $result
}
}
}
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.
1 change: 1 addition & 0 deletions PSOneTools/2.2/module.psm1 → PSOneTools/2.4/module.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

# LOADING ALL FUNCTION DEFINITIONS:

. $PSScriptRoot\Assert-PSOneFolderExists.ps1
. $PSScriptRoot\Test-PSOnePort.ps1
. $PSScriptRoot\Test-PSOnePing.ps1
. $PSScriptRoot\Foreach-ObjectFast.ps1
Expand Down

0 comments on commit 635fc55

Please sign in to comment.