Tuesday, September 4, 2012


This will create a directory with YYYYMMDD date format appended to it. For example, C:/Backup 20120904/, then it will use robocopy to copy all directories in the source to the destination folder

for /F "tokens=2-4 delims=/ " %%i in ('date /t') do set yyyymmdd=%%k%%j%%i
set "myDir=C:\Backup %yyyymmdd%"
mkdir "%myDir%"
robocopy C:\Source\ "%myDir%" /E

Stick this in a batch file and run it using task scheduler.

1. http://social.technet.microsoft.com/wiki/contents/articles/1073.robocopy-and-a-few-examples.aspx
2. http://superuser.com/questions/39377/script-to-create-folders-in-multiple-directories-using-yyyymmdd-date-as-the-fold

No comments:

Post a Comment

There was an error in this gadget