I have tried to use code below from Link, however this code can only extract Texts from my rtf files. I can only combine multiple files via PowerShell due to my platform restrictions. Is there any way to do so? Thanks in advance.
`
#source folder path
$rtfFile = [System.Io.FileInfo]”C:rtf”
#destination output filepath
$txtFile = “C:rtfoutput.txt”
if (Test-Path $txtFile) {
Remove-Item $txtFile -verbose
}
Get-ChildItem -Path $rtfFile -Filter *.rtf | foreach {
$rtBox = New-Object System.Windows.Forms.RichTextBox
$rtfText = [System.IO.File]::ReadAllText($_.FullName);
$rtBox.Rtf = $rtfText
# Get plain text
$plainText = $rtBox.Text;
$([Environment]::NewLine) | Add-Content $txtFile
("----------" + $_.FullName + "----------") | Add-Content $txtFile
# Write the plain text to the destination file
[System.IO.File]::AppendAllText($txtFile, $plainText)
}
`
Waterever is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.