如何将同名不同扩展名的文件(aaa.ax,aaa.ay,aaa.az)一同复制为另一文件名(bbb.ax,bbb.ay,bbb.az).

解决方案 »

  1.   

    你要怎么实现啊?用这个方法可以实现复制File.Copy,如果用动态复制(不确定要复制的文件)就用正则表达式匹配需要的文件,循环复制
      

  2.   

    我想知道有没有类似copy aaa.* bbb.*的功能
      

  3.   

    string path = @"C:\meng\";
    string path2 =@"C:\temp\";
    System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(path);
    System.IO.FileInfo[] fi = dir.GetFiles();
    string oldfile="";
    string newfile="";
    foreach( System.IO.FileInfo f in fi)
    {
    //Response.Write(f.Name);
    oldfile=path+f.Name;
    newfile=path2+"bbb"+f.Extension;
    File.Copy(oldfile,newfile,true);
    }
      

  4.   

    string path2 =path.Replace("aaa","bbb");