需求
快速进行ftp上传 ,下载,查询文件
原来直接在shell下操作:需要【连接,输用户名,输密码,单文件操作,存在超时限制】
太过于繁琐,容易操作失败
改进
一句命令,搞定多文件上传,下载,查询,列表等操作
后期可以加入更强大的功能
源代码
代码语言:javascript复制#!/usr/bin/python# -*- coding:utf-8 -*-#ftp.py# wklken@yeah.net#this script is used to do some operations more convenient via ftp
#1.[p]upload many files in the same time,show md5s
#2.[g]download many files in the same time,show md5s
#3.[l]list all the files on ftp site
#4.[f]search a file on ftp site,return True or Flase
#5.[h]show help info
#add upload and download operations 20111210 version0.1
#add md5sum after ops 20120308 version0.2
import sys,os,ftplib,socket
CONST_HOST = "ip"
CONST_USERNAME = "username"
CONST_PWD = "pwd"
CONST_BUFFER_SIZE = 8192
COLOR_NONE = "