Functions/Get-FileWithLeadingSpace.ps1
function Get-FileWithLeadingSpace { <# .SYNOPSIS To find files that begin with a space character .DESCRIPTION To find files that begin with a space character .PARAMETER Path The path where you want to begin looking .EXAMPLE Get-FileWithLeadingSpace -path Value Describe what this call does #> # todo add begin, process, end blocks # todo add write-verbose [CmdletBinding(ConfirmImpact='None')] Param([string] $Path) begin { Write-Verbose -Message "Starting [$($MyInvocation.Mycommand)]" } process { Get-ChildItem -Path $Path -Recurse | foreach-object { if ($_.name.length -ne $_.name.trim().length) { "$($_.basename) contains a leading space" } } } end { Write-Verbose -Message "Ending [$($MyInvocation.Mycommand)]" } } |