find/replace

hi
i have a cool script that find and replace content of apple script through smile

property searchFor : "benches"
property replaceWith : "executive"
on open filelist
	tell application "Smile" to activate
	repeat with i in filelist
		updateIt(i)
	end repeat
end open

to updateIt(i)
	tell application "Smile"
		open i
		set oldContents to (contents of window 1)
		set AppleScript's text item delimiters to searchFor
		set oldContents to oldContents's text items
		set AppleScript's text item delimiters to replaceWith
		set newContents to "" & oldContents
		set AppleScript's text item delimiters to {""}
		set contents of window 1 to newContents
		check syntax window 1
		close window 1 saving yes
	end tell
end updateIt

works well
problem - when i drop a folder on the droplet it gives me error. it only works when a bunch of files are drop on it.
i want some one to help me out to make some changes in the above script so that it works well with folders and its sub folder.

thanks

Do a search for “recursion” or “recursive” etc.

thanks greg
but i am new to applescript
please give some more information about
“recursion” or “recursive”

thanks

You can use the search button at the top of all of these pages to perform a search. For instance,
typing in “recursion” will return many existing pages with discussions and examples for recursion.