如何用代码自动修改abc.war下面的一个*.properties文件谢谢,
或者怎么拷贝个一个文件夹下面的所有文件,为什么f.renameTo(File filepath)不可以返回false

解决方案 »

  1.   

    自己通过调用dos命名解决了文件夹拷贝的问题.
      

  2.   

    新问题来了怎么判断操作系统是什么,是unix还是win怎么知道下面的cmd.exe命令放在那个盘里面??请各位大侠指教 ;
      

  3.   

    /**
         * 通过dos命令拷贝文件到saveAsPath目录里;
         * @param filePath
         * @param saveAsPath
         * @return
         */
        public boolean copyFileUseDos(String filePath, String saveAsPath)
        {
            boolean bResult = true;
            //路径名
            String strPathSource = filePath;
            String strPathDesti = saveAsPath;
            
            //cmd应用程序抽象路径 
            String strWinCmdPath = this.getFilePathOnWebApp("cmd.exe");
            
            String strCommond = strWinCmdPath + " /c" + " xcopy " + strPathSource + "\\*.* " + strPathDesti
                    + " /S/Y";//取消改写提示
        
            try
            {
                Process s = Runtime.getRuntime().exec(strCommond);
                InputStreamReader ir = new InputStreamReader(s.getInputStream());
                LineNumberReader input = new LineNumberReader(ir);
                String line;
                //打印拷贝的目录;
                while ((line = input.readLine()) != null)
                {
                    System.out.println(line);
                }
                
                input.close();
            }
            catch (IOException ex)
            {
                System.out.print(ex.getMessage());
                bResult = false;
            }        return bResult;
        }
      

  4.   

    新问题来了怎么判断操作系统是什么,是unix还是win怎么知道下面的cmd.exe命令放在那个盘里面??请各位大侠指教 ;
    这个问题也解决了,想知道下怎么将Properties记录到文件中