Android Question A simple solution for backing up your projects

BlueVision

Active Member
Licensed User
Longtime User
Do you ever spent some time thinking about backing up your projects? Honestly I did not until my harddrive crashed some weeks ago, resulting in a loss of all the sources. A hard way to reinvent now everything...
So I had to think about a cheap solution, supporting a kind of incremental backup. I remembered the early days of DOS and Windows, doing batch-programming using copy and xcopy. Newer Windows-versions assist you with the powerful command ROBOCOPY, nearly perfect for this, because ROBOCOPY is mirroring the content of a folder to a destination-folder.
All you have to do is to write a small batchfile with the commands for copying your projects-folder to an external destination-folder, this can be an USB-stick or a SD-card, and to put your batchfile into the autostart-folder.

Advantages:
- Automatic unattended backup of your projects always after booting your operating system
- Incremental backup possible if you save your existing backup to another folder before backing up your data from harddisk

Disadvantages:
- Backup runs not after quitting B4A, last changes will be saved during next boot

Sure, this is not a perfect solution, but better than the worst case. I recommend to think about backing up your data!

Example:
1.
This saves your projects with an increment of 5. Open a Texteditor copy this:

robocopy e:/backup/05 e:/backup/06 /mir
robocopy e:/backup/04 e:/backup/05 /mir
robocopy e:/backup/03 e:/backup/04 /mir
robocopy e:/backup/02 e:/backup/03 /mir
robocopy e:/backup/01 e:/backup/02 /mir
robocopy c:/b4a/projects e:/backup/01 /mir
exit

2.
Make sure the structure of the destination-folder exists on your destination. It can be checked and created with additional commands within the batchfile automatically, but is need to be done only once, I made it by hand.

3.
Save the file with the extension .bat and put the file into the Autostart-folder.

Thats all.

Cheers Andi
 
Last edited:

sorex

Expert
Licensed User
Longtime User
besides a copy to multiple destination all my projects are in a dropbox folder aswell.

so these get instantly copied to 2 other machines aswell once a file changes (during every compile)

it's also good to use File > Export to zip when you applied a lot of changes so that you can peek/roll back if needed.
(projectname_date_changedescription.zip as filename for example)
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
forgot to mention that for the first copy method mentioned SyncBackFree was used. Pretty powerful copy/sync tool and free.
 
Upvote 0

RandomCoder

Well-Known Member
Licensed User
Longtime User
Dropbox is my prefered solution. I generally have two locations for projects, those that are written by myself are in the dropbox folder and those that are downloaded from the Forum to asssist other users are stored to my PC (no need to backup).
 
Upvote 0

TomA

Active Member
Licensed User
Longtime User
First: One thing I learned many years ago (more than 20) is that you should do backups so you are covered WHEN your hard drive fails. Always assume that at some point, your hard drive will fail. I had one fail on a new computer that was less than a month old.

Second: Make sure that your backup system is automated. DO NOT depend on remembering to do backups manually yourself because almost invariably, when you need the backup the most, you will find that you haven't done one for quite a long time. I ran into that situation one time and realized that my last backup was over 3 months old.

Personally, I have two backup systems in use on my current system. One is local and uses a Seagate Backup Plus Slim Drive (available in 1 and 2 Terabytes, they have other, larger drives available). It uses a USB connection to my system and, once set up and activated, needs no further action on my part to keep backups up to date. My other backup uses Carbonite (see http://www.carbonite.com/) which does backups to the cloud (effectively giving me offsite backup - something many consider very important). Again, once set up and activated, it needs no further action on my part. Both systems keep things very up to date (presently, my Carbonite backup says it did its last update 17 minutes ago).

I know there are other systems available so do a little checking. Look for systems that are automated, and preferable include one that stores the backup in the cloud so even a major disaster will not wipe out all of your hard work.
 
Upvote 0

cimperia

Active Member
Licensed User
Longtime User
All good advice. One other crucial element is to check that your backups are good i.e can you restore your environment to a certain point in time by using your backups. You 'd surprise how often this is not tested. I have some horror stories to tell...
 
Upvote 0

BlueVision

Active Member
Licensed User
Longtime User
Like your ideas guys. I personally don't like cloud-based backups for several reasons. A strictly nogo when dealing with given data from a customer you develop the application for. Second, if you are a "mobile programmer" like me, there is not always access to the cloud. But this is not the point. Good to see that some of you developed worst-case-strategies, however it finally looks.

At the end, in my special case I did a printout of the sourcecode some months ago, that saved me from typing about 8000 lines of code again. I was able to do a scan of this printout and to recover the sourcecode by doing an OCR-scan. The OCR-work was done on Android too with an excellent little program called TEXTFEE. I was really surprised about the recognition-rate. Only small problems after that, most of it caused by recognition-mistakes (the number "1" and the letter "l" or the number "0" and the letter "O"). Fortunally, B4A's editor found 99% of these mistakes. Thats the good news in my case. However, reinventing the bugfixes and changes done since doing the printout are lost. This is enough work for reaching the level of evolution, the application had before the crash (and a good chance to change some things inside the coding ;)) .

So finally: BACKUP YOUR DATA!
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
One other crucial element is to check that your backups are good

At my former employer I used to work several years with a copy of my system in a VMWare deskop client, the benefit here is that if you changed laptops you just had to copy 1 folder and in less than half an hour you work working again without the need to file copy (slow) all your data, install all the apps again etc.

I guess that's the most safe/quickest method to have it all backup'ed and tested in minutes on another machine and doesn't require extra imaging software running on the machine (Acronis Imagine client to name something)

And with its snapshot options you can always revert to an earlier state in just minutes even when the OS doesn't boot anymore since it records block changes to the disks.
 
Upvote 0
Top