Do shell script: convert folder of DOC-files to RTF-files

Hi all,

I found some code to convert .doc files to .rtf files, using the textutil command in the terminal. Now I am trying to get this working in applescript. I figured out some code to convert a folder with files, but I am wondering if there is a quicker way to convert all the files at once (without the repeat loop) and converting only the .doc files (instead of taking every file).

Since I know little to nothing about the terminal or shell commands I hope someone is willing to help me out.

Here is what I found out so far for converting a folder of wordfiles one by one:

set inputfolder to (choose folder)
set theFiles to list folder inputfolder without invisibles

repeat with x from 1 to count of theFiles
	set thefile to item x of theFiles
	set inputfile to quoted form of (POSIX path of inputfolder & thefile)
	do shell script "textutil -convert rtf " & (inputfile)
end repeat

Hi,

the repeat loop is necessary, nevertheless this solution is very cool anyway.
To filter the doc files, you can use this

set inputfolder to (choose folder)
set theFiles to list folder inputfolder without invisibles

repeat with oneFile in theFiles
	set {name extension:Ex, kind:Ki} to (info for alias ((inputfolder as Unicode text) & oneFile))
	if Ex is "doc" or Ki contains "Microsoft Word" then
		do shell script "textutil -convert rtf " & quoted form of (POSIX path of inputfolder & oneFile)
	end if
end repeat

Try something like this:

choose folder with prompt "Convert Word documents in this folder:"

do shell script "/usr/bin/textutil -convert rtf " & quoted form of POSIX path of result & "*.doc"

Thanks Bruce,

That was the line I was hoping for. This helps me further to connect it with my rtf to Quark Xtags-script.
Thanks both of you.

Kjeld