File f = new File("d:/a");
f.renameTo(new File("d:/aa"));
文件夹a下还有文件和文件夹

解决方案 »

  1.   

    File f = new File("D:\temp\doc\type1");
    f.renameTo(new File("D:\temp\doc\typea"));
    这样可以。
      

  2.   

    renameTo
    public boolean renameTo(File dest)Renames the file denoted by this abstract pathname. 
    Whether or not this method can move a file from one filesystem to another is platform-dependent. The return value should always be checked to make sure that the rename operation was successful. 
    Parameters:
    dest - The new abstract pathname for the named file 
    Returns:
    true if and only if the renaming succeeded; false otherwise 
    Throws: 
    SecurityException - If a security manager exists and its SecurityManager.checkWrite(java.lang.String) method denies write access to either the old or new pathnames 
    NullPointerException - If parameter dest is null
      

  3.   

    goole 输入javai/o操作 找不出来一堆关于javai/o的操作你杀了我
      

  4.   

    呵呵,是啊。学会使用doc&&google就可以自己决绝很多问题了。re一下