How to Bulk Rename Files into Ordered Numbers in MacOS
Say you have 10,000 files with random names, and you want to rename them all into 1–10000 based on its current alphabetical order.
Step 1
Go to the parent folder of the nested folders. Press Alt + Right Click on the folder and click “Copy [folder name] as a Pathname”.
Next, open Terminal and enter the command below. Replace the highlighted path with the copied path of the parent folder, then press Enter.
cd /path/to/your/parent_folder
Step 2
Copy and paste this command, then press Enter.
n=1
for f in *; do
if [ -f "$f" ]; then
ext="${f##*.}"
mv -- "$f" "$n.${ext}"
n=$((n + 1))
fi
done
Voilà. That’s all.