Take Backup of Windows Web Server Using Batch Script
One of the most common, and well suited, applications for a command line script is data backup. Command line scripts can be automated to run at any time without any human interaction.
Requirements:
Windows 2000/XP/2003/Win7/2008/2012
7-Zip (it’s free).
Open Notepad or Notepad++ & Paste the Bellow Code :
set TIMESTAMP=%DATE:~7,2%-%DATE:~4,2%-%DATE:~10,4%-%TIME:~0,2%%TIME:~3,2%%TIME
:~6,2%
cd C:\WebBackup\www_backup\
md "%TIMESTAMP%"
ECHO %TIMESTAMP% > "C:\WebBackup\backuplog\www_%TIMESTAMP%.log"
ECHO "Backup of My Websites" >> "C:\WebBackup\backuplog\www_%TIMESTAMP%.log"
cd C:\www\
for /d %%X in (*) do "c:\Program Files\7-Zip\7z.exe" a "%%X.7z" "%%X\" >> "C:\WebBackup\backuplog\www_%TIMESTAMP%.log"
move C:\www\*.7z C:\WebBackup\www_backup\%TIMESTAMP%\ >> "C:\WebBackup\backuplog\www_%TIMESTAMP%.log"
exit
-- Save the File with .bat Extension. (Ex: MyScript.bat)
Here, My Web File Location is "C:\www\" & My Web File Backup Location is "
C:\WebBackup\www_backup\"
Thanks For Visiting on My Blog, For More Tutorials Keep Visiting My Blog
0 comments:
Post a Comment