Simple script to do Backup to DOW folder

Pick Language to Auto Translate:
AR | BG | CA | CS | DA | DE | EL | ES | FI | FR | HI | HR | ID | IT | IW | JA | KO | LT | LV | NL | NO | PL | PT | RO | RU | SK | SR | SL | SV | TL | UK | VI | ZH | ZH-TW

If you need a simple way to do a backup of your folder from various computer to a central location and don't want to spend a great deal of time or money for a big backup solution, the good old DOS command can do that for you.

Here is how I use a DOS command to find out the day of the week and use it as a folder to be created a central place by machine.


** The actual script that works!
For /f "tokens=1-7 delims=:/-, " %%i in ('echo exit^|cmd /q /k"prompt $D $T"') do (
For /f "tokens=2-4 delims=/-,() skip=1" %%a in ('echo.^|date') do (
set dow=%%i
set %%a=%%j
set %%b=%%k
set %%c=%%l
set hh=%%m
set min=%%n
set ss=%%o
)
)

echo Backup day of the week: %dow%

set pc=%COMPUTERNAME%
set buday=%dow%
set dest=D:\Backup\%pc%\%buday%\
rmdir /s /Q %dest%
if not exist %dest% mkdir %dest%
xcopy ".\*.*" %dest% /Y /S /F /E /K /R /H
** actual script that work!

Just copy the code above to create a file call backupDOW.bat and run it or put in a schedule for a daily run.