💻 Software
Convert text files recursively to UTF-8 in PowerShell
Fresh7 days ago
Mar 15, 202629264 viewsConfidence Score0%
0%
Problem
I have a folder with text files which includes other folders in it, and these also contain some text files. I need to recursively convert all these files to UTF-8 encoding in PowerShell and preserve the folder structure during this process. I have tried this: But it doesn't work, it can't reproduce…
Error Output
foreach( $i in get-childitem -recurse -name ) {
get-content $i | out-file -encoding utf8 -filepath some_folder/$i
}Unverified for your environment
Select your OS to check compatibility.
1 Fix
Canonical Fix
Unverified Fix
New Fix – Awaiting Verification
Fix for: Convert text files recursively to UTF-8 in PowerShell
Low Risk
Try this one. It grabs the full path of the file and replaces the current directory with the one you want. For example, you run this command in the directory ( ). If it finds the file , it'll give you a of . The first if block is there so you don't …
Awaiting Verification
Be the first to verify this fix
Sign in to verify this fix