package main import ( "os/exec" ) // exec command func doCommand(cmd string) { _ = exec.Command("sh", "-c", cmd).Run() } func main() { // if diretory not exist, create it doCommand("mkdir -p output") doCommand("libreoffice --headless --convert-to \"html:XHTML Writer File:UTF8\" *.doc --outdir output") doCommand("libreoffice --headless --convert-to \"html:XHTML Writer File:UTF8\" *.docx --outdir output") }