title: In Python 2.7, How to use scp with variable filename?
body: <p>I have following codeline written in python 2.7. I am using centos6 as OS.
  Right now I am new to python &amp; trying to learn it.</p>
  
  <p>Following code line copies all specific files (i.e. containing letter "R") in the folder /2013_06_02 from remote machine 192.168.13.152 to my local machine <em>(tony is my username on my local machine; while john is my username on remote machine)</em></p>
  
  <pre><code>os.system("scp john@192.168.13.152:/home/john/2013_06_02/11_RBPLJ1635+3808*R* /home/tony/data/")
  </code></pre>
  
  <p><strong>This works.</strong> (This code line asks password). And I get specific files in my /data directory on my local machine.</p>
  
  <p><strong>Now the problem part:</strong>
  Actually I have many folders on remote machine, each one contains many files with filenames which contain letter "R". Also Each filename begins with some no. like 11 in above example.
  Now I want to vary folder name and at the same time vary no. appearing in front of filename.</p>
  
  <p>I tried this:</p>
  
  <pre><code>date = "2013_10_05"
  mynum = "11"
  os.system("scp john@192.168.13.152:/home/john/date/mynum_RBPLJ1635+3808*R* /home/tony/data/")
  </code></pre>
  
  <p>But I got this error:</p>
  
  <pre><code>SyntaxError: EOL while scanning string literal
  </code></pre>
  
  <p>I tried this way also:</p>
  
  <pre><code>date = "2013_10_05"
  mynum = "11"
  os.system("scp john@192.168.13.152:/home/john/"date"/"mynum"_RBPLJ1635+3808*R* /home/tony/data/")
  </code></pre>
  
  <p>But this did not work.</p>
  
  <p>In short I have to make folder name &amp; file no. to be two variables to be used in scp command so that code will automate copying process; i.e. I don't have to change folder name &amp; no. in filename by hand everytime.</p>
  
  <p>I know that every time I have to type password to remote machine, if above code line works. But I don't care for that at this moment. First I want to get above codeline into working condition. Then I want to see how I can do above stuff without typing password everytime.</p>
  
  <p>Any help will be highly appreciated.
  Thanks in advance.</p>