localizeimages (366B)
1 #!/bin/sh 2 for f in *.png; do 3 containedin="$(grep -IRl "$f" .)" 4 if [ -n "$containedin" ]; then 5 case "$containedin" in 6 *index.md) 7 mv "$f" "${containedin%%index.md}" 8 ;; 9 *) 10 mkdir "${containedin%%.md}" 11 mv "$containedin" "${containedin%%.md}/index.md" 12 mv "$f" "${containedin%%.md}" 13 ;; 14 esac 15 fi 16 done