#!/bin/bash

#https://serverfault.com/questions/24067/recursive-move-utility-on-unix/1063249#1063249

# Which you could invoke like so (for the OP usecase):
# ex: recurse /public-back/templates /public/templates
# If source is a file or a directory for which the destination does not exist yet, 
# it simply moves it with mv -u. If source is a directory for which the destination already exists, 
# it iterates through its contents and recursively performs the same check followed by move|recurse with each of its members.
# I used -u because I only needed old files freshened and newer files untouched, 
# but you could replace it with -f for an unconditional move or -i for an interactive one. 
# Or not change anything and simply rm -rf your source after the script is done moving things.


recurse() {
    if [ ! -d "$1" ] || [ ! -e "$2" ]; then
        mv -f "$1" "$2" || exit
        return
    fi
    for entry in "$1/"* "$1/."[!.]* "$1/.."?*; do
        if [ -e "$entry" ]; then
            recurse "$entry" "$2/${entry##"$1/"}"
        fi
    done
}