Created
June 18, 2018 04:19
-
-
Save xight/b2a32ca28a6e32e1ea7e0ada7964371f to your computer and use it in GitHub Desktop.
Rename file to continuous number
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
#!/bin/bash | |
extension='jpg' | |
prefix=`date +%Y-%m-%d` | |
count=1 | |
for FILE in `find ./ -type f -name '*'.${extension} -maxdepth 1`; | |
do | |
mv $FILE ${prefix}-`printf '%04g\n' $count`.${extension} | |
count=$(($count + 1)) | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment