Auto delete temporary files after 15 seconds of creation The default setting given to delete temp files is after 6 hours minimum. I have users upload files and I want that if it has temp status, delete it after 15 secs. Tweaking the file module code is risky, if I get the exact location to change 6 hours to 15 sec that will do the job.
The value stored in this config
\Drupal::config('system.file')-&gt;set('temporary_maximum_age', '15');

You can update that with the value you wants.
If you want to change the form as well which is recommended use hook_form_FORM_ID_alter to adjust the system file settings from system_file_system_settings
The current implementation looks like this
$intervals = [0, 21600, 43200, 86400, 604800, 2419200, 7776000];
$period = array_combine($intervals, array_map([$this-&gt;dateFormatter, 'formatInterval'], $intervals));
$period[0] = $this-&gt;t('Never');
$form['temporary_maximum_age'] = [
  '#type' =&gt; 'select',
  '#title' =&gt; $this-&gt;t('Delete temporary files after'),
  '#default_value' =&gt; $config-&gt;get('temporary_maximum_age'),
  '#options' =&gt; $period,
  '#description' =&gt; $this-&gt;t('Temporary files are not referenced, but are in the file system and therefore may show up in administrative lists. &lt;strong&gt;Warning:&lt;/strong&gt; If enabled, temporary files will be permanently deleted and may not be recoverable.'),
];

You can alter the form and adjust it to what you want.
Keep in mind, to see this happen your corn must run at least every 15 sec.