bash : mv filenames to serial by ctime Hint

find $P -type f -print0 | xargs -0 ls -tr | while read file; do

        N=$((N+1))

        new=$( printf "%05d.%s" $N "${file##*.}" )

        mv "$file" "$new"

done