我的应用程序将 txt 文件存储在 FTP 服务器上,该服务器也托管在网络服务上。
在我托管 txt 文件的目录中,我可以找到其他 txt 文件。每次存储新文件时,我都想删除当前目录中的所有文件。
实际上我正在尝试使用以下命令:
FTPClient ftpClient = new FTPClient();
ftpClient.connect(siteFTP);
if (ftpClient.login(usrFTP, pswFTP)) {
ftpClient.enterLocalPassiveMode();
FTPFile[] remoteFiles = ftpClient.listFiles(path);
if (remoteFiles.length > 0) {
ftpClient.deleteFile("/prenotazioni/*.txt");
}
}
但即使该目录中有 txt 文件,FTP 响应也是:
> DELE /prenotazioni/*.txt
> 550 File not found
尚方宝剑之说
白衣非少年
相关分类