0

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.

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()

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

Is there anyway to achieve this with Python?

rcubefather
  • 1,534
  • 6
  • 25
  • 49

1 Answers1

0

The best solution I know, is to use Fabric. See: How do I copy a directory to a remote machine using Fabric?.

Community
  • 1
  • 1
Laurent LAPORTE
  • 21,958
  • 6
  • 58
  • 103