I have JPG files numbered 3006-3057 that I would like to reverse number. I would be content renaming them by adding a backwards number count to the beginning of the name: img_3006.jpg > 99_img_3006.jpg and img_3057.jpg > 48_img_3057.jpg.开发者_如何学Python
basenumber=9999
for file in *.jpg
do
base="${file%.*}"
filenumber="${base#*_}"
mv "$file" "$((basenumber-filenumber))_$file"
done
精彩评论