zoukankan      html  css  js  c++  java
  • java 新建文件夹保存

    String Txtname = field.getText();
                    File file3 =new File("D:\MATP_robot"+"\"+ Txtname);    
                    //如果文件夹不存在则创建    
                    if  (!file3 .exists()  && !file3 .isDirectory())      
                    {       
                        System.out.println("//不存在");  
                        file3 .mkdir();    
                    } else   
                    {  
                        System.out.println("//目录存在");  
                    }  

                    File file = new File(".\config\batfolder\Matp.bat");
                    if (file.exists()) {
                        file.delete();
                    }
                    BufferedWriter writer = null;

                    try {
                        writer = new BufferedWriter(new FileWriter(
                                ".\config\batfolder\Save.bat", true));
                    } catch (IOException e2) {
                        // TODO Auto-generated catch block
                        e2.printStackTrace();
                    }

                    try {
                        writer.write("echo off" + " ");
                        writer.write("copy .\config\shutter_button.txt "+ "D:\MATP_robot"+"\"+Txtname
                                + " ");

                        writer.flush();
                        writer.close();
                    } catch (IOException e1) {
                        // TODO Auto-generated catch block
                        e1.printStackTrace();
                    }
                    
                    RAMThreadOn mRAMThreadOn = new RAMThreadOn();
                    mRAMThreadOn.run();
                    String Txtname2 = field2.getText();
                    File f = new File("D:\MATP_robot\"+"\"+Txtname+"\"+"shutter_button.txt");
                    System.out.println(f);
                    f.renameTo(new File("D:\MATP_robot\" + "\"+Txtname+"\" + Txtname2 + ".txt"));
                    System.out.println(f + "========11========");
                    JOptionPane.showMessageDialog(null, "脚本保存在D:\MATP_robot"+"\"+Txtname+"目录中");
                    field2.setText("");
                    
                }
                field.selectAll();
                // 隐藏对话框
                setVisible(false);

  • 相关阅读:
    Magicodes.IE之Excel模板导出教材订购表
    【总结】《氨基酸新晋管理者领导力培训》第一次课_Day2_学习心得
    【总结】《氨基酸新晋管理者领导力培训》第一次课_Day1_学习心得
    【管理】从技术走向管理
    python写入excel(xlswriter)--生成图表
    python-写入excel(xlswriter)
    python读取excel(xlrd)
    python接口自动化测试(八)-unittest-生成测试报告
    python接口自动化测试(六)-unittest-单个用例管理
    python接口自动化测试(七)-unittest-批量用例管理
  • 原文地址:https://www.cnblogs.com/dreamy890322/p/4478389.html
Copyright © 2011-2022 走看看