Friday, May 29, 2015

Backup And Compress Folder Contents To Another Location Via Batch Files Based On Date And Time

                                          For taking the backup of a folder contents to another local folder.Here we need to take data backup from “c:\wamp\www” to another local folder in Drive F: (F:\Backup).In destination location,the backed up folder names created Data and Time wise.Also zipped the destination folder.
  1. Created new test document and copy the below mentioned script into it
  2. Finally Save the file as a .bat extension
  3. Download and Install 7 Zip application software  
@echo off
@COLOR 0A
echo **** IT Tech Beats Backup Solution******
:: variables
set drive=F:\Backup

set year=%DATE:~10,4%
set day=%DATE:~7,2%
set month=%DATE:~4,2%
set hr=%TIME:~0,2%
set min=%TIME:~3,2%

set ICTOPS=%day%-%month%-%year%-%hr%-%min%

set backupcmd=xcopy /s /c /d /e /h /i /r /k /y
echo ### Backing up your Websites ...

"c:\Program Files\7-Zip\7z.exe"  a -t7z -r "%drive%\%ICTOPS%" "C:\wamp\www\*.*"
echo !!!!!!!!BACKUP COMPLETED.Your Backup is located at %drive% THANKS  !!!!!!!!
pause

No comments:

Post a Comment

bloggerwidgets