There is little evidence for what the durations of a course should be.
Recommended durations are usually based on historical practice rather than on reliable evidence. Where high quality studies have been conducted, shorter durations have efficacy as good as longer durations (e.g. Spellberg, 2016. Llewelyn 2017, Wald-Dickler 2019). Click here to see a table comparing treatment durations.
Here are some web-pages which have guidelines about anitibiotics.