target_dir=~/.vim/bundle/vaxe/ultisnips
source_dir=~/.vim/bundle/vaxe/snippets 
filetypes=(haxe nmml hxml)

for target_ft in ${filetypes[*]} 
do
   mkdir -p $target_dir 
   ULTISNIPS_OUTPUT=$target_dir/$target_ft.snippets
   ULTISNIPS_SOURCE=$source_dir/$target_ft.snippets
   python ~/.vim/bundle/Ultisnips/utils/convert_snipmate_snippets.py $ULTISNIPS_SOURCE > $ULTISNIPS_OUTPUT
   echo '# This file is autogenerated by tools/create_ultisnips.sh, any edits will be overwritten.
# (Edit' $ULTISNIPS_SOURCE 'instead.)' | cat - $ULTISNIPS_OUTPUT > temp && mv temp $ULTISNIPS_OUTPUT
done

