Compare two Folder Contents using c# -


i need compare 2 folder contents based on

1.no of files 2.size of files 3 date 

and got error index out of bound exception in piece of code

 private void seekfiles(string root)     {     string[] files = system.io.directory.getfiles(root);     string[] folders = system.io.directory.getdirectories(root);     fileinfo file;        for(int i=0; i< folders.length; i++)     {     file = new fileinfo(files[i]);     foldersize += file.length;     }      for(int i=0; i< folders.length-1; i++)     {     seekfiles(folders[i]);     }     }  

any suggestion??

looks using wrong index on wrong collection :

for(int i=0; i< folders.length; i++) {     file = new fileinfo(files[i]);     foldersize += file.length; } 

should :

for(int i=0; i< **files.length**; i++) {     file = new fileinfo(files[i]);     foldersize += file.length; } 

Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

400 Bad Request on Apache/PHP AddHandler wrapper -

php - Change action and image src url's with jQuery -