optional-typeextensions/fileinfo.types.ps1xml
<!--
Alias and script properties designed to extend the file object. There is also a PropertySet called AgeInfo. --> <Types> <Type> <Name>System.IO.FileInfo</Name> <Members> <AliasProperty> <Name>Size</Name> <ReferencedMemberName>Length</ReferencedMemberName> </AliasProperty> <ScriptProperty> <Name>SizeKB</Name> <GetScriptBlock>[math]::Round($this.length/1KB,2)</GetScriptBlock> </ScriptProperty> <ScriptProperty> <Name>SizeMB</Name> <GetScriptBlock>[math]::Round($this.length/1MB,2)</GetScriptBlock> </ScriptProperty> <ScriptProperty> <Name>ModifiedAge</Name> <GetScriptBlock> New-TimeSpan -Start $this.LastWriteTime -End (Get-Date)</GetScriptBlock> </ScriptProperty> <ScriptProperty> <Name>CreatedAge</Name> <GetScriptBlock> New-TimeSpan -Start $this.CreationTime -End (Get-Date)</GetScriptBlock> </ScriptProperty> <AliasProperty> <Name>Created</Name> <ReferencedMemberName>CreationTime</ReferencedMemberName> </AliasProperty> <AliasProperty> <Name>Modified</Name> <ReferencedMemberName>LastWriteTime</ReferencedMemberName> </AliasProperty> <PropertySet> <Name>AgeInfo</Name> <ReferencedProperties> <Name>Directory</Name> <Name>Name</Name> <Name>Size</Name> <Name>LastWriteTime</Name> <Name>ModifiedAge</Name> </ReferencedProperties> </PropertySet> </Members> </Type> </Types> |