title: Recursive directory copy with Paramiko in Python
body: <p>I am new to Python scripting. I need to copy few folders from my local machine (windows) to Linux server. As of now, I am copying the folders by opening WinSCP console. I need to automate this process. I have written a below code in Python using Paramiko module library.</p>
  
  <pre><code>import paramiko
  import os
  transport = paramiko.Transport(('10.10.10.10', 22))
  transport.connect(username='weblogic', password='weblogic')
  sftp = paramiko.SFTPClient.from_transport(transport)
  filepath = '/apps/logs'
  localpath = 'C:\\Users\\Public\\test'
  sftp.put(localpath,filepath)
  </code></pre>
  
  <p>Above is not working properly and giving below error. Can you please help me to copy the folder present in the windows path <code>C:\Users\Public\test</code> to Linux server path <code>/apps/logs</code>?</p>
  
  <pre class="lang-none prettyprint-override"><code>Traceback (most recent call last):
    File "C:\Users\Desktop\python\execute_script.py", line 28, in &lt;module&gt;
      sftp.put(localpath,filepath)
    File "C:\Python27\lib\paramiko\sftp_client.py", line 548, in put
      fl = file(localpath, 'rb')
  IOError: [Errno 13] Permission denied: 'C:\\Users\\Public\\test'
  </code></pre>