Add alphanumeric prefixes to files inside a directory that serves as queue

In case, as in my previous article about example, you use a directory as queue, you may want an easy way to rename files.

For instance, if you have files like shot001.png, shot003.png, shot012.png, whenever you want to insert a file at a specific position in the queue, you are forced to rename it to something like shotXXX.png; you may even have to rename other files.

So this script add a prefix like CCC5—$file in front until it reaches WWW… using 7 differents characters only, so it’s really easy to insert files anywhere. If it reaches WWW, then it’ll use the form WWWNNN5—, NNN being a three digits counter. You can set how many digits you want with the option —max-queue-digits so you virtually can manage queue with as many files as you want (however unpractical that could actually be). It works on the current directory, only on regular files, and actually does not do anything unless you set the option –please-do in order to avoid any accidental mess.