【发布时间】:2018-10-02 09:22:57
【问题描述】:
我正在尝试将 dat 文件的大文件转换为 UTF-8 以将它们加载到数据库中(这些文件上有日文字符)。最大文件为 17 GB,整个目录为 34 GB。下面是我的 PowerShell 脚本。
$files = Get-ChildItem 'E:\datamig_bkp_SCMDB\data\bigfiles' -Recurse |
? {Test-Path $_.FullName -PathType Leaf}
foreach ($file in $files) {
$content = Get-Content $file.FullName
$content | Out-File $file.FullName -Encoding UTF8
}
我遇到以下错误:
Get-Content:引发了“System.OutOfMemoryException”类型的异常。 在行:3 字符:16 + $content = 获取内容 $file.FullName + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [Get-Content], OutOfMemoryException + FullyQualifiedErrorId : ProviderContentReadError,Microsoft.PowerShell.Commands.GetContentCommand【问题讨论】:
标签: powershell encoding utf-8