Doing
glob.glob('/var/log/apache2/other_vhosts_access.log*')
gives an unsorted list such as ['....76.gz', '....16.gz', '....46.gz', ...]
. Also,
sorted(glob.glob('/var/log/apache2/other_vhosts_access.log*'))
gives
other_vhosts_access.log
other_vhosts_access.log.1
other_vhosts_access.log.10.gz
other_vhosts_access.log.11.gz
other_vhosts_access.log.12.gz
...
other_vhosts_access.log.19.gz
other_vhosts_access.log.2.gz
How to have a better sort? .log, .log.1, .log.2.gz, ..., .log.9.gz, .log.10.gz, ...