有空么,帮我写一个吧Dos有没有这方面的命令阿

解决方案 »

  1.   

    public static  void copy(File dir_src,String  dir_des){

    for(int i=0;i<dir_src.listFiles().length;i++){
    File f=dir_src.listFiles()[i];
    if(f.isDirectory()){
    copy(f,dir_des+"/"+f.getName());
    }else{
    try {
    File dir=new File(dir_des);
    if(!dir.exists()){
    dir.mkdirs(); 
    }

    FileChannel in=new FileInputStream(f).getChannel();
    File f_des=new File(dir_des+"/"+f.getName());
    FileChannel out=new FileOutputStream(f_des).getChannel();
    System.out.print("copy "+f.getAbsolutePath()+" to " +f_des.getAbsolutePath()+"...");
    in.transferTo(0, in.size(), out);
    in.close();
    out.close();
    System.out.println("success");
    } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }
    }
    }
    }
      

  2.   

    LS的估计就可了,文件夹名字的规则你可以自己来定。
    通过 if(f.isDirectory()){
                    copy(f,dir_des+"/"+f.getName());
                }
    这句递归,会把所有子目录文件都拷贝到你的目标文件夹。
      

  3.   

    不过bat的话也应该可以,dos命令也行吧
    用xcopy xxxxx? 
    或者如下:
    path   c:\windows\system32   
    copy   f:\eudc.*   c:\winnt\fonts   
      

  4.   

    有没有人能够提供DOS或者批处理的解决方案阿把代码贴一下
      

  5.   

    copy  f:\eudc.*  c:\winnt\fonts