I'm trying to back up certain files and directories in a script.
So far i have:
bkdest=/Web
sources=("includes_php" "html/css" "html/includes" "html/index.php")
datestamp=$(date +%Y_%m_%d_%H_%M_%S)
odir=/Web-Backup/${datestamp}_Web
for target in ${sources[@]}; do
mkdir -p ${odir}${target}
cp -R /Web${target} ${odir}${target}
done
The problem I am having is that I copy the folder, into an identically named folder when i copy folders. Is there a better way of doing this or do I need to handle folders and files in separate lists?
The machine I am using is on 10.12.6 if that makes a difference.
/Web
? Also, what exactly is the problem you need solving here?