-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsftp.py
More file actions
30 lines (27 loc) · 749 Bytes
/
sftp.py
File metadata and controls
30 lines (27 loc) · 749 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# -*- coding: utf-8 -*-
__author__ = 'blfeng'
import sys,os
sys.path.append(os.getcwd()+'/lib')
import paramiko,os,Sftp,string
def main():
hostname = ''
username = ''
password = ''
remotepath = '/tmp'
localpath = 'lib'
port = 22
f=open("conf/hostname.txt")
while True:
line = f.readline()
if line:
ini_line = line.split(':',3)
c = map(string.strip, ini_line)
hostname=c[0]
username=c[1]
password=c[2]
s = Sftp.Sftp(hostname=hostname,username=username,password= password,port=port,localpath=localpath,remotepath=remotepath)
s.sftp()
else:
break
if __name__=='__main__':
main()