I want to rename the files in a directory to sequential numbers. Based on creation date of the files.
For Example sadf.jpg to 0001.jpg, wrjr3.jpg to 0002.jpg and so on, the number of leading zeroes depending on the total amount of files (no need for extra zeroes if not needed).
Try to use a loop,
let, andprintffor the padding:using the
-iflag prevents automatically overwriting existing files, and using--preventsmvfrom interpreting filenames with dashes as options.