Yev Bronshteyn

Authored Comments

Bash/she may give consistency across platforms, but the utilities they invoke sometimes do not.

I do not assert that powershell never deprecates or modifies features or that all syntax is identical across versions. However, you can be certain of getting the same features and syntax in your execution by simply bundling the correct version of Powershell (6.0 or later) with your script(s). In other words, your application can own its automation environment, instead of relying on the operating system to provide it. That’s how you can guarantee consistency.

This is a great example of what powershell can easily do! I think Get-ChildItem, Select-Object, and Where-Object are among the few cmdlet where the alias is more straightforward than the fullname. So I’d replace them with “cd”, “select”, and “?” (or “where”), respectively.

Have you tried using Measure-Object -Maximum to get the newest file modification date instead of sorting the whole directory?