string sourcePathA = @"patha"
string sourcePathB = @"pathb";
string[] filenames = Directory.GetFiles(sourceParhA) ;
string[] directories = Directory.GetDirectories(sourcePathA);
 
foreach(string file in fileNames)
{
string useName = file.Substring(fie.LastIndexOf('\\')+1);
string comparefile = sourcePathB + "\\" + useName;
if(File.Exists(comparefile))
{
FileStream fsa = new FIlesStream(file,FileMode.Open,FIleAccess.Read);
StreamReader sra = new StreamReader(fsa,Encoding.Default);
string linea = sra.ReadToEnd();
&n

 
                   
                   
                   
                   该博客介绍了一种方法来比较两个文件夹中同名文件的内容是否相同。通过遍历文件夹,获取文件名,然后打开并读取每个文件的内容,逐一进行对比。如果发现文件内容不一致,则停止比较。
该博客介绍了一种方法来比较两个文件夹中同名文件的内容是否相同。通过遍历文件夹,获取文件名,然后打开并读取每个文件的内容,逐一进行对比。如果发现文件内容不一致,则停止比较。
           最低0.47元/天 解锁文章
最低0.47元/天 解锁文章
                           
                       
       
           
                 
                 
                 
                 
                 
                
               
                 
                 
                 
                 
                
               
                 
                 扫一扫
扫一扫
                     
              
             
                   2270
					2270
					
 被折叠的  条评论
		 为什么被折叠?
被折叠的  条评论
		 为什么被折叠?
		 
		  到【灌水乐园】发言
到【灌水乐园】发言                                
		 
		 
    
   
    
   
             
            


 
            