Command to rename all files in a directory in numerical sequence

You are here:
< All Topics

Command to rename all files in a directory in numerical sequence.

 

.ext can be changed to whichever extension you require.

 

ls -v | cat -n | while read n f; do mv -n “$f” “$n.ext”; done

Disclosure: The above article may include affiliate links for products and services for which this site may receive remuneration.
Table of Contents