4 ms·
I think powershell still isnt really that hard for this (and was mentioned earlier) Something like: gci / -recurse | sort fullname | select fullName, length
by hobs 11y ago
I think powershell still isnt really that hard for this (and was mentioned earlier)
Something like:
gci / -recurse | sort fullname | select fullName, length -first 5
Really doesnt seem that hard in comparison.
- untog 11y agoAgreed. It's interesting - last time I looked at PowerShell it seemed insanely verbose, but maybe I was looking at some odd examples.
- hobs 11y agoOh, it can be. The confusion lies around the fact that you can do basic things half a dozen ways, and I also used some shorter aliases (eg Get-ChildItem (or gci, or ls) Sort-Object (sort) Select-Object (select)) You can sort of choose what level of verbosity you want to encode in your scripts for your sanity at a later date.
- WorldMaker 11y agoAs pointed out a lot of the verbosity in PowerShell is optional these days as there are a good number of aliases for common commands. The nice thing about the verbosity is kind of similar to the point of SQL in that it too has something of a natural language DSL intent (in PowerShell commands are expected to be "Verb-Noun" and verbs for the most part are encouraged to be from a relatively small set of common verbs). This can make it a bear to fully write out without an IDE (and there are multiple choices these days) or tab completion (which gets better with each release). The benefit however, is that typically you can very easily read someone's PS1 script if it has been written at full verbosity and know what it is doing. It's often very close to self-documenting at that point.