config/ranger/rename.sh

   1 #!/bin/bash
   2 
   3 du -h "$@" |
   4 while read size file; do
   5     res=$(identify -format '%wx%h' "$file")
   6     new="${file:0:1}_${res:-0x0}-${size/,/.}.${file##*.}"
   7 
   8     echo "'$file' -> '${new/ () / }'"
   9     mv -n "$file" "${new/ () / }"
  10 done