easily backup your htdocs dir

Problems with the Windows version of XAMPP, questions, comments, and anything related.

easily backup your htdocs dir

Postby aveeshkumar » 30. November 2009 10:25

Hi,

To those who might want a date-based backup of the htdocs folder

- this will let you backup all files/folders from the root of htdocs incl subdirectories to a folder names Y-M-D
- exclude certain directories/files based on name or file extension
- create a log file called log - y-m-d


I had spent hours looking at free backup solutions for my localhost xampp windows installation and finally came up with the following:
1. After installing in c:\xampp, I created a directory caled c:\backup
2. In there I put in backup.bat which is:
----------------------
@echo off

FOR /F "TOKENS=1* DELIMS= " %%A IN ('DATE/T') DO SET CDATE=%%B
For /f "tokens=1-4 delims=/ " %%a in ('date /t') do (set dateymd=%%c-%%b-%%a)
echo %dateymd%

SET dir=%dateymd%\
SET logfile=backup-log-%dateymd%.txt
echo %dir%
echo %logfile%
rem md %dir%
xcopy ..\htdocs\*.* %dir% /s /EXCLUDE:backup-exclude.txt > %logfile%
------------------------------
NOTE:
1 - this assumes that the system date (DOS) is in d-m-Y format. If not, modify the set dateymd accordingly
2. credits for the above file go to several posts I found after googling (DOS batch file date...)
3. The xcopy command allows you to specify a file that lists what you want to exclude from xcopy. Mine contains:
-----------------------------
blog\
content\
dojo\
email\
files\
xampp\
.zip
.exe
---------------------------

Hope this helps someone - if there is a better solution, please be gentle in your replies. Thanks to Apachefriends for an easy to use great webserver....

If this is of help, please email me at aveeshkumar at gmail dot com to inspire me to post more often :-)
aveeshkumar
 
Posts: 1
Joined: 06. October 2009 19:40

Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 60 guests