Skip to content

Instantly share code, notes, and snippets.

@pinecones-sx
Created May 18, 2016 15:19
Show Gist options
  • Save pinecones-sx/4df4b9403b9197b11984e6a04893a027 to your computer and use it in GitHub Desktop.
Save pinecones-sx/4df4b9403b9197b11984e6a04893a027 to your computer and use it in GitHub Desktop.
Issue w/function to create custom object
function global:Get-CompFolder{
param($iFolderLoc)
$objCompFolder = [Ordered]@{
'Location' = $iFolderLoc
'Folder' = Get-Item $iFolderLoc
'Tree' = Get-ChildItem $iFolderLoc -Recurse |
Add-Member -MemberType ScriptProperty -Name 'RelativeName' -Force -PassThru -Value {
$this.FullName -replace ('.*' + [regex]::escape($iFolderLoc))
}
'SortedTree' = @()
}
Return New-Object -TypeName PSObject -Property $objCompFolder
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment