Open in (OS X) Terminal here...
…seems so handy! but doesn’t come with the system.
now, obviously the problem has already been encountered before:
so i used this to get started (and finished) - result is a Finder.app Workflow:
on run {input, parameters}
repeat with i in input
my processItem(i)
end repeatreturn input
end run
…just accompany this snippet with on processItem(i) and on canChangeDirectoryTo(f), save it as Workflow - done.