Automate Adding Footer to HTML files in Directory

Hi all,

I am trying to run through a directory of HTML files and append HTML at the end of the text file. I am using textwrangler as my text editor.


set theFolder to ("Macintosh HD:Users/winter/Desktop/HTMFILES/")
tell application "Finder" to set theFiles to files of folder theFolder whose name extension is "html"
repeat with oneFile in theFiles
	tell application "TextWrangler"
		open (oneFile as alias)
		add suffix text of document 1 suffix "<p>My footer disclaimer...</p>"
		close document 1 saving yes
	end tell
end repeat

but when I run this, i receive the following error:
error “Can’t make «class docf» "Active.html" of «class cfol» "RMI" of «class sdsk» of application "Finder" into type alias.” number -1700 from «class docf» “Active.html” of «class cfol» “RMI” of «class sdsk» to alias

I am new to applescript and would appreciate some direction.

Thank you

Hi,

you cannot mix colon and slash separators in a path


set theFolder to "Macintosh HD:Users:winter:Desktop:HTMFILES:"

or, more portable


set theFolder to ((path to desktop as text) & "HTMFILES:")

Thank You!