On The Power Of Calculated Properties In Powershellđź”—
2 min readNov 27, 2021
The aim of this page📝 is to show where I’ve used calculated properties in posh, basically for advanced querying of a file system when I wanted to get the table where each file would have a parent folder next to it. I am using this one for the creation of markdown-based boards for tracking e.g. learning progress of a course that I have in .mp4
format.
- Posh calculated properties are powerful map functions you can apply to any object arriving through the pipeline with the
Select-Object
cmdlet.
folder Name
------ ----
10. Course Overview 10. Course Overview.mp4
11. Course Introduction 10. Course Introduction.mp4
12. Getting Docker 10. Module Overview.mp4
12. Getting Docker 11. Docker Desktop.mp4
12. Getting Docker 12. Play with Docker.mp4
13. Deploying a Containerized App 10. Module Overview.mp4
13. Deploying a Containerized App 11. Warp Speed Run-through.mp4
13. Deploying a Containerized App 12. Containerizing an App.mp4
13. Deploying a Containerized App 13. Hosting on a Registry.mp4
13. Deploying a Containerized App 14. Running a Containerized App.mp4
13. Deploying a Containerized App 15. Managing a Containerized App.mp4
13. Deploying a Containerized App 16. Recap.mp4
14. Microservices and the Real World 10. Module Overview.mp4
14. Microservices and the Real World 11. Cloud-native Microservices.mp4
14. Microservices and the Real World 12. Multi-container Apps with Docker Compose.mp4
14. Microservices and the Real World 13. Taking Things to the Next Level with Docker Swarm.mp4
14. Microservices and the Real World 14. Microservices and Docker Services.mp4
14. Microservices and the Real World 15. Multi-container Apps with Docker Stacks.mp4
15. What's Next- 10. What's Next-.mp4
EXAMPLE 2: LIST OF FOLDERS AND FILECOUNTS
Get-ChildItem $rootFolder `
-Recurse -Directory |
Select-Object `
BaseName, `
@{Name="FileCount";Expression={(Get-ChildItem $_ -File |
Measure-Object).Count }} | Format-TableAWS 33
bash 79
bi 37
bookmarks 232
books 2
C 1
c-sharp 35
clojure 18
cloud 21
cs 79
csgt 8
DATA 9