Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- folder="~/Immagini"
- tag="speleologia"
- destination="/tmp"
- #tmpfile="/tmp/result.txt"
- tmpfile=$(tempfile)
- baloosearch -d $folder "tags:$tag" > $tmpfile
- while read line
- do
- if [ -f "$line" ]; then
- destname="$destination/${line##*/}"
- n=1
- while [ -f "$destname" ]
- do
- if cmp -s "$line" "$destname" ; then
- break
- else
- let "n += 1"
- tmpname=${line##*/}
- destname="$destination/${tmpname%.*}_$n.${tmpname##*.}"
- fi
- done
- cp "$line" "$destname"
- echo "$destname OK"
- fi
- done <$tmpfile
- rm $tmpfile
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement