Created
July 5, 2019 10:37
-
-
Save imbdb/d33674b6f41780db7d8c6fb65d1b21b2 to your computer and use it in GitHub Desktop.
Rename all files to numbers
This file contains 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
# Find all files with specified pattern using find and then mv them to new numbered name | |
# eg. abc.jpeg, sdfs.jpeg,... --> 0001.jpeg,0002.jpeg,... | |
find -iname '*.jpeg' | # find files | |
gawk 'BEGIN{ a=1 }{ printf "mv \"%s\" \"%04d.jpeg\"\n", $0, a++ }' | # build mv command ( Change 04d(0000) to your number your files) | |
bash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment