Ganymed SSH-2 for Java系列5之删除远程服务器上的目录(补充说明)

来源:互联网 发布:cad mac中文破解版2016 编辑:程序博客网 时间:2024/04/30 01:34

上一篇讲到了如何删除服务器的目录,大家可能都发现了,通过上面的命令只能删除服务器上的一个空目录,其源码的注释已经给了说明:

[java] view plaincopy在CODE上查看代码片派生到我的代码片
  1. /** 
  2.      * Remove an empty directory.  
  3.      *  
  4.      * @param dirName See the {@link SFTPv3Client comment} for the class for more details. 
  5.      * @throws IOException 
  6.      */  
  7.     public void rmdir(String dirName) throws IOException  
  8.     {  
  9.         int req_id = generateNextRequestID();  
  10.   
  11.         TypesWriter tw = new TypesWriter();  
  12.         tw.writeString(dirName, charsetName);  
  13.   
  14.         sendMessage(Packet.SSH_FXP_RMDIR, req_id, tw.getBytes());  
  15.   
  16.         expectStatusOKMessage(req_id);  
  17.     }  


Remove an empty directory. 


如果删掉的目录下面存在目录和文件,那么我们

改如何处理啦,下面的一篇我们将处理这个问题。

0 0
原创粉丝点击