● 파일명 길이 출력

Get-ChildItem | ForEach-Object {
       $fileName = $_.Name
       $length = $fileName.Length
       Write-Output "파일: $fileName, 길이: $length"
}

 

● 특정 파일명 길이 가지고 있는 텍스트 파일 찾기

Get-ChildItem *.txt -Recurse -File | Where-Object {
       $_.Name.Length -gt 63 -and $_.Name.Length -lt 65
} | Select-Object Name, Length


+ Recent posts