Created
August 8, 2017 13:29
-
-
Save pioz/1cd3855492662b9bfd3cf6fc836f50f0 to your computer and use it in GitHub Desktop.
Rename file in batch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ls * | cat -n | while read i f; do mv "$f" `printf "%04d.${f#*.}" "$i"`; done | |
ls * | cat -n | while read i f; do mv "$f" `printf "$(basename $f .${f#*.})_%04d.${f#*.}" "$i"`; done | |
https://stackoverflow.com/a/45569550/302005 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment