Remove uploaded files before the 6 hours cron?
file_cron() contains the code that delete managed files. To adapt it to delete those files with their status set to 0, this is what I would use.

$file_storage = \Drupal::entityTypeManager()-&gt;getStorage('file');
$fids = Drupal::entityQuery('file')-&gt;condition('status', 0)-&gt;execute();
$files = $file_storage-&gt;loadMultiple($fids);

foreach ($files as $file) {
  $references = \Drupal::service('file.usage')-&gt;listUsage($file);
  if (empty($references) &amp;&amp; file_exists($file-&gt;getFileUri())) {
    $file-&gt;delete();
  }
}


This code returns you all the files matching those conditions. You can also use the following code to get them in batches of 100 per time.

$file_storage = \Drupal::entityTypeManager()-&gt;getStorage('file');
$fids = Drupal::entityQuery('file')-&gt;condition('status', 0)-&gt;range(0, 100)-&gt;execute();
$files = $file_storage-&gt;loadMultiple($fids);

foreach ($files as $file) {
  $references = \Drupal::service('file.usage')-&gt;listUsage($file);
  if (empty($references) &amp;&amp; file_exists($file-&gt;getFileUri())) {
    $file-&gt;delete();
  }
}


I didn't check, but it is probable you can also filter the returned file entities by the bundle using them.