getting comic files in the correct order

petertavy

Newbie
Aug 21, 2020
82
18
A problem I had with some comics is that the image viewer displays the pictures in alphabetical order:

1, 10, 100, 101, 102, ... 109, 11, 110 112, ... 199, 2 ...

Linux provides a command called "rename" which can rename files in bulk. I have written a shell program
that renames the files by padding short numbers with initial zeros. Then, alpha order is correct:

001, 002, 003, ... 010, etc

To use: copy the spoiler somewhere, say path/padnumber .

You don't have permission to view the spoiler content. Log in or register now.

Give it execute permission. then do:

cd /comic-directory
path/padnumber

I hope you will find this useful. There are some known problems.

1. Earlier versions failed because the comic's author used filenames with punctuation characters. In order to try to
make this version reliable I had to make it replace every string of punctuation characters (except full stop) by a single
underscore. I hope this version is now reliable (it has not yet failed for me) but I urge you to backup your comic before
proceeding.

2. Program is not clever enough to distinguish between the serial number of a file & other numbers like dates. So
a file like

alice!!%the££camel had 3 []] humps on 1 jan .jpg

might get renamed as

alice_the_camel _had _003_humps_on_001_jan .jpg

3. If your comic's directory has subdirectories, the program cannot descend into them & run itself recursively.