用ftplib链接局域网ftp共享盘的代码和各种参数~转~

From ftplib import FTP

ftp = FTP()

ftp.encoding = ‘gbk’

ftp.connect(地址,端口=21)

ftp.login(用户名,密码)

ftp.sendcmd(链接模式)

ftp.cwd(文件路径)

  1. ftp链接参数

命令

描述

RFC

Description

ABOR

(ABORT)此命令使服务器终止前一个FTP服务命令以及任何相关数据传输。

Abort an active file transfer.

ACCT

(ACCOUNT)此命令的参数部分使用一个Telnet字符串来指明用户的账户。

Account information.

ADAT

(AUTHENTICATION/SECURITY DATA)认证/安全数据

RFC 2228

Authentication/Security Data

ALLO

为接收一个文件分配足够的磁盘空间

Allocate sufficient disk space to receive a file.

APPE

增加

Append.

AUTH

认证/安全机制

RFC 2228

Authentication/Security Mechanism

CCC

清除命令通道

RFC 2228

Clear Command Channel

CDUP

改变到父目录

Change to Parent Directory.

CONF

机密性保护命令

RFC 2228

Confidentiality Protection Command

CWD

改变工作目录

Change working directory.

DELE

删除文件

Delete file.

ENC

隐私保护通道

RFC 2228

Privacy Protected Channel

EPRT

为服务器指定要连接的扩展地址和端口

RFC 2428

Specifies an extended address and port to which the server should connect.

EPSV

进入扩展被动模式

RFC 2428

Enter extended passive mode.

FEAT

获得服务器支持的特性列表

RFC 2389

Get the feature list implemented by the server.

HELP

如果指定了命令,返回命令使用文档;否则返回一个通用帮助文档

Returns usage documentation on a command if specified, else a general help document is returned.

HOST

确定服务器上所需的虚拟主机名。

RFC 7151

Identify desired virtual host on server, by name.

LANG

语言协商

RFC 2640

Language Negotiation

LIST

如果指定了文件或目录,返回其信息;否则返回当前工作目录的信息

Returns information of a file or directory if specified, else information of the current working directory is returned.

LPRT

为服务器指定要连接的长地址和端口

RFC 1639

Specifies a long address and port to which the server should connect.

LPSV

进入长被动模式

RFC 1639

Enter long passive mode.

MDTM

返回指定文件的最后修改时间

RFC 3659

Return the last-modified time of a specified file.

MIC

完整性保护命令

RFC 2228

Integrity Protected Command

MKD

创建目录

Make directory.

MLSD

如果目录被命名,列出目录的内容

RFC 3659

Lists the contents of a directory if a directory is named.

MLST

提供命令行指定的对象的数据

RFC 3659

Provides data about exactly the object named on its command line, and no others.

MODE

设定传输模式(流、块或压缩,S=流模式,B=块模式,C=压缩模式)

Sets the transfer mode (Stream, Block, or Compressed).

NLST

返回指定目录的文件名列表

Returns a list of file names in a specified directory.

NOOP

无操作(哑包;通常用来保活)

No operation (dummy packet; used mostly on keepalives).

OPTS

为特性选择选项

RFC 2389

Select options for a feature.

PASS

认证密码

Authentication password.

PASV

进入被动模式

Enter passive mode.

PBSZ

保护缓冲大小

RFC 2228

Protection Buffer Size

PORT

指定服务器要连接的地址和端口

Specifies an address and port to which the server should connect.

PROT

数据通道保护级别

RFC 2228

Data Channel Protection Level.

PWD

打印工作目录,返回主机的当前目录

Print working directory. Returns the current directory of the host.

QUIT

断开连接

Disconnect.

REIN

重新初始化连接

Re initializes the connection.

REST

从指定点重新开始传输

Restart transfer from the specified point.

RETR

传输文件副本

Retrieve a copy of the file

RMD

删除目录

Remove a directory.

RNFR

从...重命名

Rename from.

RNTO

重命名到...

Rename to.

SITE

发送站点特殊命令到远端服务器

Sends site specific commands to remote server.

SIZE

返回文件大小

RFC 3659

Return the size of a file.

SMNT

挂载文件结构

Mount file structure.

STAT

返回当前状态

Returns the current status.

STOR

接收数据并且在服务器站点保存为文件

Accept the data and to store the data as a file at the server site

STOU

唯一地保存文件

Store file uniquely.

STRU

设定文件传输结构

Set file transfer structure.

SYST

返回系统类型

Return system type.

TYPE

设定传输模式(ASCII/二进制) A/I.

Sets the transfer mode (ASCII/Binary).

USER

认证用户名

Authentication username.

XCUP

改变之当前工作目录的父目录

RFC 775

Change to the parent of the current working directory

XMKD

创建目录

RFC 775

Make a directory

XPWD

打印当前工作目录

RFC 775

Print the current working directory

XRCP

RFC 743

XRMD

删除目录

RFC 775

Remove the directory

XRSQ

RFC 743

XSEM

发送,否则邮件

RFC 737

Send, mail if cannot

XSEN

发送到终端

RFC 737

Send to terminal

响应代码

解释说明

110

新文件指示器上的重启标记

120

服务器准备就绪的时间(分钟数)

125

打开数据连接,开始传输

150

打开连接

200

成功

202

命令没有执行

211

系统状态回复

212

目录状态回复

213

文件状态回复

214

帮助信息回复

215

系统类型回复

220

服务就绪

221

退出网络

225

打开数据连接

226

结束数据连接

227

进入被动模式(IP 地址、ID 端口)

230

登录因特网

250

文件行为完成

257

路径名建立

331

要求密码

332

要求帐号

350

文件行为暂停

421

服务关闭

425

无法打开数据连接

426

结束连接

450

文件不可用

451

遇到本地错误

452

磁盘空间不足

500

无效命令

501

错误参数

502

命令没有执行

503

错误指令序列

504

无效命令参数

530

未登录网络

532

存储文件需要帐号

550

文件不可用

551

不知道的页类型

552

超过存储分配

553

文件名不允许

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

kakupigs

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值