It means "-erroraction stop".
https://devblogs.microsoft.com/scripting/handling-errors-the-powershell-way/
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
what does this code mean, esp. -ea and "stop"? thanks
$parentFolders = Get-ChildItem $srcPath -ea "Stop" |
Where-Object {$_.PSIsContainer -eq $true} |
Sort-Object
It means "-erroraction stop".
https://devblogs.microsoft.com/scripting/handling-errors-the-powershell-way/
In addition to the answer given by @MotoX80 , the Get-ChildItem cmdlet will send a stream of information about all the children of the directory name held in the variable $srcPath into a pipeline. The Where-Object will receive those data and, if any of them represent a directory, send the information into another pipeline. The Sort-Object will receive the data from the second pipeline and sort. it and then send the result to the "Success" stream (becasue there's no other pipeline specified). The sorted information from the Success stream will be stored in the variable "$parentFolders".
The Where-Object, in this case, is unnecessary and can be replaced by using the Get-ChildItem switch "-Dir". Like this:
$parentFolders = Get-ChildItem $srcPath -Dir -ErrorAction "Stop" |
Sort-Object