Skip to main content



How to Rename a Batch of Files in Numbered Sequence
·356 words·2 mins
bash bash script rename
To rename files in numbered sequence, use a simple Bash script in the directory. #!/bin/bash # Step 1: Choose a prefix read -p "Choose a prefix: " prefix # Initialize a counter i=1 # Step 3: Use a for loop to iterate through the files for file in *; do # Step 4: Use the mv command to rename and printf to format mv "$file" "$(printf "$prefix"_%03d.