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?
The best solution I know, is to use Fabric . See: How do I copy a directory to a remote machine using Fabric? .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.