convert.go 366 B

123456789101112131415161718
  1. package main
  2. import (
  3. "os/exec"
  4. )
  5. // exec command
  6. func doCommand(cmd string) {
  7. _ = exec.Command("sh", "-c", cmd).Run()
  8. }
  9. func main() {
  10. // if diretory not exist, create it
  11. doCommand("mkdir -p output")
  12. doCommand("libreoffice --headless --convert-to html *.doc --outdir output")
  13. doCommand("libreoffice --headless --convert-to html *.docx --outdir output")
  14. }