title: golang failed exec command that works in terminal
body: <p>I am getting an error when I try to use the <code>exec</code> package to run a <code>mv</code> command.</p>
  
  <p>Here is an example of what I am trying to do:</p>
  
  <pre><code>cmd := exec.Command("mv", "./source-dir/*", "./dest-dir")
  output, err := cmd.CombinedOutput()
  
  cmd.Run()
  </code></pre>
  
  <p>err returns the following
  <code>exit status 1</code></p>
  
  <p>output returns this <code>mv: rename ./source-dir/* to ./dest-dir/*: No such file or directory</code></p>
  
  <p>I can actually get the script to work when I change this line:</p>
  
  <p><code>cmd := exec.Command("mv", "./source-dir/*", "./dest-dir")</code></p>
  
  <p>to the following:</p>
  
  <p><code>cmd := exec.Command("mv", "./source-dir/file.txt", "./dest-dir")</code></p>
  
  <p>The command works and moves the file successfully but using the wildcard doesn't work. It appears that the asterisk isn't being used as a wildcard in the command. Why is that? Is there another way to use wildcards in GO? If not then how else would I be able to recursively move all files from the <code>source-dir</code> to the <code>dest-dir</code>?</p>
  
  <p>Thanks</p>