将文件或目录移动到另外的目录

    // File (or directory) to be moved
    File file = new File();
    
    // Destination directory
    File dir = new File();
    
    // Move file to new directory
    boolean success = file.renameTo(new File(dir, file.getName()));
    if (!success) {
        // File was not successfully moved
    }
阅读更多
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭