title: How to run complex python commands using subprocess using relative reference?
body: <p>I am trying to execute this command using Python:</p>
  
  <pre><code>findSyntax = "find . -maxdepth 2 -name '.config' | cpio -updm ../test1/"
  subprocess.Popen(findSyntax.split(' '))
  </code></pre>
  
  <p>But this command just would not work. When I execute this command, it will start listing all the files (not just .config) under the . directory beyond the maxdepth 2... which is a long list.</p>
  
  <p>What am I missing here! Can someone point it out? Thanks.</p>
  
  <p>NOTE: I've tried running <code>subProcess.run</code> as well with same results. I was able to get just the find part working using <code>os.system()</code> command.</p>
  
  <p>EDIT: I just wanted to clarify that this command will copy the files found with the exact directory structure intact to the new location (creating subdirectories if necessary). I've tried this command on bash terminal, and it works fine. But I couldn't get it to work with Python.</p>
  
  <blockquote>
    <p>EDIT2: So, the whole command works with <code>os.system()</code>, but I couldn't figure out how to make it work with <code>subprocess</code>. <code>os.system()</code> is supposed to be deprecated, so I would be very interested in figuring out the solution using <code>subprocess</code> instead.</p>
  </blockquote>