i do something like that with some software i use for mirroring in Inferno, where i take advantage of dynamically-loaded module that traverses the structures and applies another command or module as it goes.