delete
删除 SFTP 或 FTP 服务器上的文件
说明
示例
删除文件
连接到 FTP 服务器并删除文件。此示例显示 ftp.example.com
(实际上并不存在的计算机)上的一个假想 FTP 会话。如果您拥有 FTP 服务器帐户,有权在该服务器上上传和删除文件,则可以像本例中一样使用 delete
函数。
首先,连接到服务器。
s = ftp('ftp.example.com')
FTP with properties: Host: "ftp.example.com" Username: "anonymous" Port: 21 ServerLocale: "en_GB" DirParserFcn: @matlab.io.ftp.parseDirListingForUnix Mode: "binary" LocalDataConnectionMethod: "passive" RemoteWorkingDirectory: "/"
显示 FTP 服务器上当前文件夹的内容。
dir(s)
myscript.m README.txt pub
删除名为 README.txt
的文件。
delete(s,'README.txt')
显示当前文件夹的更新内容。README.txt
文件不再可以下载。
dir(s)
myscript.m pub
输入参数
s
— 连接到 SFTP 或 FTP 服务器
SFTP 对象 | FTP 对象
与 SFTP 或 FTP 服务器的连接,指定为 SFTP 对象或 FTP 对象。
filename
— 要删除的文件的名称
字符向量 | 字符串标量
要删除的文件的名称,指定为字符向量或字符串标量。
版本历史记录
在 R2006a 之前推出
MATLAB 命令
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)