#!/bin/bash # This scripts helps you to fix file ordering linux issues. # They are related to the idea that images without leading zeros (frame1.png but not frame0001.png) # is incorrectly ordered by the system and, thus, cannot be used in ffmpeg or wherever other scripts, # in a correct order. So, this scripts adds leading zeros. In this example, in scans file from 1 to 2500. m1=($(seq 1 2500)) m2=($(seq -w 0001 2500)) echo ${m1[20]} echo ${m2[20]} for i in {1..2500..1}; do mv frame${m1[$i]}.png frame${m2[$i]}.png done