PowerShell Module
Define PowerShell module:
# comm_func.psm1
$ORA_CONNECTION = $null
Function FileExist {
param ([String] $path)
If($path -eq $null) {
Return $False
} Else {
Return (Test-Path -Path "$path" -PathType leaf)
}
}
Function FolderExist {
param ([String] $path)
If(($path -eq $null) -Or ($path -eq '')) {
Return $False
} Else {
Return (Test-Path -Path "$path")
}
}
# export module
Export-ModuleMember -Function "*Exist"
Export-ModuleMember -Variable "ORA_CONNECTION"
Put it in use:
Import-Module comm_func.psm1
if (-not (FolderExist "$a_dir")) {
mkdir "$a_dir"
}