Backup Your Folder Using Batch File

Posted on Updated on

I got tired of copy/pasting my folder files every morning. Though it is just Ctrl+C then Ctrl+V then rename the folder, it has been a redundant and boring task.

To make things a little faster, I created a batch file for my everyday back-up routine. Well actually, i just combined scripts i got from google.

@echo off
@REM Seamonkey’s quick date batch (MMDDYYYY format)
@REM Setups %date variable
@REM First parses month, day, and year into mm , dd, yyyy formats and then combines to be MMDDYYYY

FOR /F “TOKENS=1,2 eol=/ DELIMS=/ ” %%A IN (‘DATE/T’) DO SET mm=%%B
FOR /F “TOKENS=1,2 DELIMS=/ eol=/” %%A IN (‘echo %CDATE%’) DO SET dd=%%B
FOR /F “TOKENS=2,3 DELIMS=/ ” %%A IN (‘echo %CDATE%’) DO SET yyyy=%%B
SET date=%mm%-%dd%-%yyyy%

@echo off
mkdir “D:/backup/webfolder %date%”
xcopy “C:/webfolder” “D:/backup/webfolder %date%” /E

So everyday it would create a folder

D:/backup/webfolder monthtoday-daytoday-yeartoday  (D:/backup/webfolder 12-16-2008)

Then copy the files and subdirectory from


to the new backup folder directory

And because my work is starts at 7am, i created a scheduled task every 7:30am everyday to run my batch file.

sweet ^_^

Another step crossed out from my daily work routine.

thanks to:


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s