Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'convert WordPerfect directly to RTF' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
convert WordPerfect directly to RTF
Authored by: deef on Dec 13, '06 09:24:31AM

Hey, thanks for posting this. I had come up with more or less the same solution but hadn't posted.

Here's a bash script that can be run from the command line to convert WP files to rtfs. It assumes that wpd2html is installed and in your $PATH . Given filename.wpd it will create a new file filename.rtf . And it accepts multiple files as input so you can turn it loose on a whole directory.

#!/bin/sh
# bash script to convert wordperfect files to rtfs

for filename in "$@"
do if [ -z "$filename" -o ! -e "$filename" ]
then echo "Bad filename: $filename"
exit 1
fi
done

for filename in "$@"
do
#the actual conversion
wpd2html "$filename" > "$filename".html
textutil "$filename".html -convert rtf
rm -f "$filename".html

#cleanup
oldName="$filename"
newName=${oldName/.WPD/.rtf}
newName=${newName/.wpd/.rtf}
mv "$filename".rtf "$newName"
done;



[ Reply to This | # ]