while read found; do
# make a corresponding directory if there isn't one yet.
if [ ! -d "$target/$found" ]; then
- mkdir "$target/$found"
+ mkdir -p "$target/$found"
fi
# move all the files out of the source and into the target.
mv "$found"/* "$target/$found/"