Skip to main content
Home
Blog

Main navigation

  • Home
User account menu
  • Log in

Breadcrumb

  1. Home

Simple script to do Backup to DOW folder

By ongetc , 9 February, 2017

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.

Reseller hosting (free)

Hosting24 (w/ ssh)

A2 Hosting

Monthly archive

  • September 2009 (14)
  • October 2009 (11)
  • January 2010 (2)
  • June 2010 (3)
  • October 2011 (1)
  • March 2012 (1)
  • July 2012 (1)
  • February 2017 (564)
  • March 2017 (5)
  • April 2017 (2)

Pagination

  • 1
  • Next page

Popular content

Last viewed:

  • InfoGlue
  • Exponent
  • OpenIT
  • Croogo
  • PdoLite
  • Midgard
  • htmldog.com
  • Apache OFBiz®
  • JavaScript DB
  • MosNewsWriter

User login

  • Reset your password