TO answer the original question, why your script copied just the folder structure...
It was due the parameters on the xcopy, you specified just these /m/e/y:
/M = Copies only files with the archive attribute set, turns off the archive attribute.
/E = Copies directories and subdirectories, including empty ones.
/Y = Suppress confirmations.
Notice that as the answer given before, just by adding /D and removing /M it will make the trick, please check what the help says about /D:
/D:m-d-y Copies files changed on or after the specified date.
If no date is given, copies only those files whose
source time is newer than the destination time.
In case you need to back up multiple folders in one run and have a log file with their executions, you can have something like this:
@echo off
call:backUpFolder "C:\Users\XXX\folder1" "C:\Backup\folder1"
call:backUpFolder "C:\Users\XXX\folder2" "C:\Backup\folder2"
call:backUpFolder "C:\Users\XXX\folder3" "C:\Backup\folder3"
goto:eof
::--------------------------------------------------
::-- This is the function to back up one folder
::--------------------------------------------------
:backUpFolder
set source="%~1"
set destination="%~2"
echo copying from %source% to %destination%
for /F "usebackq tokens=1,2 delims==" %%i in (`wmic os get LocalDateTime /VALUE 2^>NUL`) do if '.%%i.'=='.LocalDateTime.' set ldt=%%j
set ldt=%ldt:~0,4%-%ldt:~4,2%-%ldt:~6,2% %ldt:~8,2%:%ldt:~10,2%:%ldt:~12,6%
xcopy %source%"\*" %destination%"\*" /s/d/y/c/v/r
echo %ldt%: %source% to %destination% >> backHistory.log
echo Finished copying %source% to %destination%
goto:eof