title: How to move PDF files to Folders based on File size
body: <p>I have 10 million files in a particular location.I want to group the files based on file size using Parallel ForEach in C#.let's say I have 5 files. each file 5 MB, I want to move 2 files to Folder1, the next 2 files to Folder 2, and the last one is to Folder3.so each folder containing PDF files cannot be more than 10 MB.</p>
  <p>Sample</p>
  <p>Folder1 -- File1,File2
  Folder2 -- File3,File4
  Folder3 -- File5.</p>
  <p>Code Sample</p>
  <pre><code>var files = Directory.EnumerateFiles(&quot;C://Data&quot;);;
  
  Parallel.ForEach(files , file
  {
     
  var Total Size = file.Lenth;
  
  });
  </code></pre>