New function dir2xml
bugfix and improve dir2xml
use mc.preschedule = FALSE, close #39