#!/bin/bash
(cd total && rm -f *.{jpg,png,gif,jpeg})
find . -regextype posix-extended -regex '.*\.(png|jpeg|jpg|gif)' | \
    grep -vP '^\./total/' | \
    (while read img ; do
        ln -sf "../$img" "./total/$(basename "$img")"
    done)
