title: rm all files under a directory using python subprocess.call
body: <p>I'm writing a script that will move files into a .trash directory in a user's home folder. I want to add the ability to empty the trash directory by calling <code>rm -rf /home/user/.trash/*</code> using python's subprocess.call()  </p>
  
  <pre><code>~$ touch file1
  ~$ trash file1
  ['mv', 'file1', '/home/rodney/.trash/']
  ~$ ls .trash
  file1
  ~$ trash --empty
  ['rm', '-rf', '/home/rodney/.trash/*']
  ~$ ls .trash
  file1
  </code></pre>
  
  <p>As you can see the rm command did not remove the contents of the trash. However if I execute the command directly on the command line it works.</p>
  
  <pre><code>~$ rm -rf /home/rodney/.trash/*
  ~$ ls .trash
  ~$ 
  </code></pre>
  
  <p>The output is from the following code</p>
  
  <pre><code>print(cmd)
  subprocess.call(cmd)
  </code></pre>
  
  <p>What is weird about this is if I exclude the * from the last argument in the cmd list then the subprocess call works but also removes the entire .trash directory. I do not want to delete the .trash directory; only everything under it.</p>
  
  <p>To sum up the question</p>
  
  <p>This works</p>
  
  <pre><code>import subprocess
  subprocess.call(['rm', '-rf', '/home/rodney/.trash/'])
  </code></pre>
  
  <p>This does not</p>
  
  <pre><code>import subprocess
  subprocess.call(['rm', '-rf', '/home/rodney/.trash/*'])
  </code></pre>
  
  <p>Why?</p>