Skip to content

Instantly share code, notes, and snippets.

@organom
Created January 13, 2024 22:25
Show Gist options
  • Save organom/e097f8f245293c41da4b3eecf5edcd0a to your computer and use it in GitHub Desktop.
Save organom/e097f8f245293c41da4b3eecf5edcd0a to your computer and use it in GitHub Desktop.
Renames files in folder (argument) to a sequantial name (ex: 01.mkv). Improve printf in case more than 100 files are required
!#/bin/bash
cd $1
ls | cat -n | while read n f; do ext=${f##*.}; mv "$f" `printf "%02d.$ext" $n`; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment