How to get files from Remote windows server to local Windows machine directory?
<p>I am using a tool which will create files in remote windows 2012 servers continuously. I need to get those files and place it in a local directory.</p>

<pre><code>import os
import time

def copy_logs():
    os.system(".\pscp.exe -pw test123 C:/Users/Administrator/Desktop/tr* Administrator@1.1.1.1:/")
    time.sleep(7200)    
while True:
    copy_logs()
</code></pre>

<p>I have used 'pscp' inside python script to copy files. But I am unable to specify space/destination directory to copy the files into.</p>

<p>Is there anyway to achieve this with Python?</p>

<p>The best solution I know, is to use <a href="http://www.fabfile.org/" rel="nofollow">Fabric</a>. See: <a href="http://stackoverflow.com/questions/5314711">How do I copy a directory to a remote machine using Fabric?</a>.</p>

python python-2.7