#! /bin/sh echo "scanning $1 for attachments" noteName=$(echo $1|awk -F'/' '{print $(NF-1)}') attachments=$(cat $1|egrep "\[\[(Resources\/attachments\/.*?)\]\]"|tr -d '![]'|awk -F'/' '{print $(NF)}') echo "Found Attachments:" echo $attachments for a in $attachments; do # echo "find . -name $a -exec mv {} /tmp/blog/content/notes/$noteName/$a \;" find . -name $a -exec mv {} /tmp/blog/content/notes/$noteName/$a \; done