title: Deleting Folders filled with files doesn't free up space immediately
body: <p>When I delete a Folder using </p>
  
  <pre><code>DirectoryInfo.Delete(true)
  </code></pre>
  
  <p>the value for </p>
  
  <pre><code>DriveInfo.AvailableFreeSpace
  </code></pre>
  
  <p>stays nearly the same. For instance when I delete folders in a loop while checking <code>availablefreespace</code> I end up deleting gigabytes and gigabytes of data when it should have deleted less then a gigabyte.</p>
  
  <pre><code>//Delete in secondary storage
  string secondaryRoot = Path.GetPathRoot(settings.SecondaryFeatureExtractDirectory);
  DriveInfo secondaryDrive = new DriveInfo(secondaryRoot);
  DirectoryInfo secondaryInfo = new DirectoryInfo(settings.SecondaryFeatureExtractDirectory);
  while ((secondaryDrive.TotalSize - secondaryDrive.AvailableFreeSpace) / secondaryDrive.TotalSize * 100 &lt; settings.DriveFreePercentage)
  {
      logger.LogInformation("checkForCleanup before delete: {@Freespace}", secondaryDrive.AvailableFreeSpace);
      secondaryThresholdPassed = true;
      DirectoryInfo oldestDir = secondaryInfo.EnumerateDirectories().OrderBy(x =&gt; x.LastWriteTimeUtc).FirstOrDefault();
      if (oldestDir == null) break;
      oldestDir.Delete(true);
      logger.LogDebug("checkForCleanup deleted: {@DirectoryName}", oldestDir.FullName);
      logger.LogInformation("checkForCleanup after delete: {@Freespace}", secondaryDrive.AvailableFreeSpace);
      Thread.Sleep(1);
  
  }
  </code></pre>
  
  <p>Is there any was around this using c# and dotnetcore?</p>