script/gen-corpus: cleanup and improve readability and performance
- gen-corpus cleanup missed removing the temporary directory.
- improve it a bit for readability
- import.sh script was slow, improve performance by using less forks and
batch processing