recursive file copy function
fix templates: copy plugin state