>while ((fileName = this.PopQueue(path, filter)) != "" && llSuccess) >{ > // Do all my stuff here, process each file returned until no more files are returned. >} >This line while ((fileName = this.PopQueue(path, filter)) != "" && llSuccess)
string fileName; fileName = this.PopQueue(path, filter); while (fileName !="" && llSuccess) ( fileName = ..; do stuff } <pre> > <pre> >private string PopQueue(string path, string filter) >{ > try > { > DirectoryInfo directory = new DirectoryInfo(path); > FileInfo[] files = directory.GetFiles(filter); > this.FilesInQueue = files.Length; > > foreach (FileInfo file in files) > { > // Verify this file isn't in the deleteList already > if (deleteFileList.Contains(file.Name) == false) > { > return file.Name; > } > else > { > this.DeleteDataFile(path, file.Name); > } > } > } > catch (DirectoryNotFoundException) > { > // Need to try to recover the directory & or re-create it. > } > catch (Exception ex) > { > EventLogger.LogException(ex); > } > // When the directory is empty, return an empty string. > return ""; >} >