deleteLimited method
Similar to File.delete, but limits concurrency to the current semaphore limit to avoid excessive parallel I/O operations.
Helps prevent Too many open files errors and reduces disk
contention when deleting multiple files concurrently.
Implementation
Future<void> deleteLimited({bool recursive = false}) async {
await _semaphore.acquire();
try {
await delete(recursive: recursive);
} finally {
_semaphore.release();
}
}