ls | perl -nle 'BEGIN {$counter=0}; $old=$_;$new="caption"."$counter".".txt"; +rename($old,$new);$counter++;'