Revert "remove exporttodir and use export"

This reverts commit ede3666c184fd6ec4a20465b8d4cbe5aec2b83ea.
remove exporttodir and use export

remove exporttodir and use export