JavaBlog.fr / Java.lu DEVELOPMENT Backup your projects

Backup your projects

Hello again,

Here, I expose a simple solution to backup your developments in the remote directory \\YOUR_SERVER_or_EXTERNALDISK\backupWorkspaces\.

To do this:
– Create file “backup.dat” in your Eclipse workspace ie “R:\java\dev\eclipse_workspaces\default-3.3”:

echo off
set fileDate=DEV_%date:~0,2%%date:~3,2%%date:~8,2%.zip

move %1*.zip %1backup.old

echo.
echo Backup of sources on %1
echo.
C:\PROGRA~1\7-Zip\7z.exe a -tzip -r -xr!.metadata %1%fileDate% @backup_listfile.txt

IF %ERRORLEVEL% == 0 ( GOTO SUCCESS ) ELSE ( GOTO ERROR )
 
:SUCCESS
del %1backup.old
GOTO END
 
:ERROR
echo.
echo Error: %ERRORLEVEL%
echo.

:END

– Create file “backup_listfile.txt” in your Eclipse workspace ie “R:\java\dev \eclipse_workspaces\default-3.3”:

R:\java\dev\eclipse_workspaces\default-3.3

– Create a Windows scheduled task (“Scheduled Task”) that runs the daily BATCH.

Notes:
–  This batch uses 7zip compressor to be installed in C:\Program Files\7-Zip.
– You could add more resources to backup in the “backup_listfile.txt” file.

Sincerely,

backup.zip

Leave a Reply

Your email address will not be published.

Time limit is exhausted. Please reload CAPTCHA.

Related Post