- Renames files in ascending order.
- Allows setting the starting number for renaming.
- Allows specifying the file type to rename.
./renamer.sh -a <starting_number> -t <filetype>
-a <starting_number>: The number from which the renaming should start.-t <filetype>: The file extension/type to rename without the dot character (e.g. "JPG", not ".JPG").
To rename all .JPG files in the current directory starting from 0001.JPG, run:
./renamer.sh -a 1 -t JPG
- Bash shell
- Clone the repository or download the script.
- Make the script executable:
chmod +x renamer.sh
The script uses the getopts command to parse the command-line arguments and then renames files using a loop. The new filenames are generated in the format XXXX.<filetype> where XXXX is a zero-padded number starting from the specified starting_number.