For the life of me I can&#039;t figure out why I keep getting an IndexOutOfBoundsError with this code. I simply want to loop through the contents of a folder and move all but the last file (one single file) into a different directory. More specifically, it creates the directory I need, but it moves ALL the files into that directory and doesn&#039;t spare the last, final file in the original folder, which it is supposed to. I then get the aforementioned error...<BR><BR>I included as much code as needed - it goes deeper into other methods intertwined into it from other assemblies.....but this code is where the problem is (as the app worked fine before I wrote this part).<BR><BR>/**** method from assembly ****/<BR>public FileInfo[] GetFileInfo(out DateTime fileDate, string dirName, string fileExt)<BR>{<BR> string reportPath = this.ReportsPath;<BR> string directoryName = dirName;<BR><BR> DirectoryInfo ReportFile = new DirectoryInfo(reportPath + dirName);<BR> FileInfo[] fileList = ReportFile.GetFiles(fileExt);<BR> fileDate = fileList[0].CreationTime;<BR> return fileList;<BR>}<BR><BR>/**** code in Page_Load of my web app ****/<BR>//create dir if it doesn&#039;t exist<BR>string reportsPath = @"C:Program FilesmyreportsReports\";<BR>string usrDirectory = "userdirectory";<BR>string combinedDirs = reportsPath + usrDirectory;<BR>FileInfo[] grabFileList = fileObj.GetFileInfo(out outFileDate, usrDirectory, "*.htm");<BR><BR>if (!Directory.Exists(combinedDirs + "_bak"))<BR>{<BR> Directory.CreateDirectory(combinedDirs + "_bak");<BR>}<BR><BR>if (grabFileList.Length &#062; 1)<BR>{<BR> foreach (FileInfo singleFile in grabFileList)<BR> {<BR> if (grabFileList.Length == 1) break;<BR> File.Move(combinedDirs + "\" + singleFile.ToString(), combinedDirs + "_bak\" + singleFile.ToString() + ".bak");<BR> }<BR>}<BR><BR>