Finding Files in a Folder having Carriage return


Below is the simple powershell script to find Files in a Folder having Carriage return

Get-ChildItem -Path ‘\\fileshare\folder’ | ForEach-Object {

$contents = [System.IO.File]::ReadAllText($_.FullName)

if ($contents -cmatch ‘\r\n’) {

$_.BaseName

}

}

Happy scripting.

Regards,

Chaitanya

Leave a comment

Design a site like this with WordPress.com
Get started