如何在Java中将文件夹移动到另一个文件夹

时间:2019-05-02 10:03:51

标签: java

我正在创建Java软件,将文件夹移动到同一台计算机上其他用户的另一个文件夹,但是在移动文件和文件夹时遇到了一些问题

 private void bMoveFoldersActionPerformed(java.awt.event.ActionEvent evt) {                                             
        // TODO add your handling code here: 
        File file = new File(diretorioPastaOrigem.getText());
        File file2 = new File(diretorioPastaDestino.getText());

        // renaming the file and moving it to a new location 
        if(diretoryFinalFolder== null || diretoryInicialFolder== null) { 
            System.out.println("ERRO ");
        } 
        else
        { 
            this.diretoryInicialFolder.copy();
            this.diretoryFinalFolder.paste();
        } 
    }

0 个答案:

没有答案