Convert AI to PDF

Hi All

REcently bought Orielly’s Applescript book and trying to learn AS. I found part of this code in the Illustrator documentation.Trying to convert Ai files in a folder, convert and place them in destination folder. How do you grab a list of AI files in a folder? Here is code I have
Thanks

set targetFolder to choose folder with prompt "Choose AI folder:"
set TargetFiles to files of targetFolder as list

set destinationFolder to choose folder with prompt "Choose the EPS Folder."



ExportFilesAsEPS(TargetFiles, targetFolder, destinationFolder)

on ExportFilesAsEPS(fileList, filePath, destinationFolder)
	set destinationPath to destinationFolder as string
	set fileCount to count of fileList
	if fileCount > 0 then
		repeat with i from 1 to fileCount
			set fileName to item i of fileList
			set fullPath to filePath & fileName
			set newFilePath to destinationPath & fileName & ".EPS"
			tell application "Adobe Illustrator"
				open POSIX file fullPath as alias without dialogs
				save current document in file newFilePath as eps ¬
					with options {class:EPS save options ¬
					, compatibility:Illustrator 9 ¬
					, preview:color Macintosh ¬
					, embed linked files:true ¬
					, include document thumbnails:true ¬
					, embed all fonts:true ¬
					, CMYK PostScript:true ¬
					, PostScript:level 2}
				close current document saving no
			end tell
		end repeat
	end if
end ExportFilesAsEPS

This will grab all “.ai” files in a folder and dump them into the list.

set targetFolder to choose folder with prompt "Choose AI folder:"
tell application "Finder"
	try
		set TargetFiles to (every file whose name extension is "ai") of targetFolder as alias list
	on error
		set TargetFiles to (every file whose name extension is "ai") of targetFolder as alias as list
	end try
end tell