I can list the image files in a directory and they look like this:
['IMG_3842.CR2', 'IMG_3843.CR2', 'IMG_3844.CR2', 'IMG_3846.CR2', 'IMG_3847.CR2',
'IMG_3848.CR2', 'IMG_3849.CR2', 'IMG_3850.CR2', 'IMG_3851.CR2', 'IMG_3852.CR2',
'IMG_3855.CR2', 'IMG_3856.CR2', 'IMG_3857.CR2', 'IMG_3858.CR2', 'IMG_3859.CR2']
The file numbers range from 3842 to 3859. However, there are gaps in the numbers. What I need to do is get a list like this as an output:
3842-3844, 3846-3852, 3855-3859