I get sick of repeating code. In that spirit this function gives me one line to create a new file (or folder) instead of four (or more) quickly:
functionCreate-FSOIfNotExists
{
param(
[ValidateNotNullOrEmpty()]
$path,
[ValidateSet(Directory,File)]
$itemtype
)
if(-not(Test-Path-Path$path))
{
New-Item-Path$path-ItemType$itemtype |
Out-Null;
}
}
All sorts of Verbose output could (probably should) be added to this to make it chattier, but, I just needed a quick utility function and this does the trick.
About lamsim
Author Description here.. Nulla sagittis convallis. Curabitur consequat. Quisque metus enim, venenatis fermentum, mollis in, porta et, nibh. Duis vulputate elit in elit. Mauris dictum libero id justo.