__author__ = 'dacxu'
__mail__ = 'xudacheng06.com'
__date__ = '2013-10-29'
__version = 1.0
import sys
import os
import json
from ftplib import FTP
_XFER_FILE = 'FILE'
_XFER_DIR = 'DIR'
class Xfer(object):
'''
@note: upload local file or dirs recursively to ftp server
'''
def __init__(self):
self.ftp = None
def __del__(self):
pass
def setFtpParams(self, ip, uname, pwd, port = 21, timeout = 60):
self.ip = ip
self.uname = uname
self.pwd = pwd
self.port = port
self.timeout = timeout
def initEnv(self):
if self.ftp is None:
self.ftp = FTP()
print '### connect ftp server: %s ...'%self.ip
self.ftp.connect(self.ip, self.port, self.timeout)
self.ftp.login(self.uname
Python实现FTP上传文件或文件夹(递归)
最新推荐文章于 2024-05-28 15:45:40 发布