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”:

01echo off
02set fileDate=DEV_%date:~0,2%%date:~3,2%%date:~8,2%.zip
03 
04move %1*.zip %1backup.old
05 
06echo.
07echo Backup of sources on %1
08echo.
09C:\PROGRA~1\7-Zip\7z.exe a -tzip -r -xr!.metadata %1%fileDate% @backup_listfile.txt
10 
11IF %ERRORLEVEL% == 0 ( GOTO SUCCESS ) ELSE ( GOTO ERROR )
12  
13:SUCCESS
14del %1backup.old
15GOTO END
16  
17:ERROR
18echo.
19echo Error: %ERRORLEVEL%
20echo.
21 
22:END

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

1R:\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