Last active
August 27, 2019 14:45
-
-
Save manualbashing/afacdb31490ec0e02eee3891c62479cd to your computer and use it in GitHub Desktop.
Convert all files in the current folder from CRLF to LF (recursively)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Explicit version | |
| $files = Get-ChildItem -Recurse -File | |
| foreach ($path in $files.FullName) | |
| { | |
| $crlfContent = Get-Content $path | |
| $lfContent = ($crlfContent -join "`n") + "`n" | |
| Set-Content -Path $path -Value $lfContent -NoNewline | |
| } | |
| # Short version | |
| (ls -Rec -File).FullName | % {$p = $_; ((gc $p) -join "`n") + "`n" | sc -N $p} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment