I have created a java code for performing a file, folder structure backup on the server. Now the code is working perfectly. The code looks into a specified directory and monitors changes made to files and creates a compressed backup.
So on a first time run , the code backs up all the files and folders. The consecutive times it makes a compressed backup of only the changed files / folders.
Currently the backup runs only when the client side program initiates a request. I made the backup script run on the server as a cron job now. It creates the compressed backup files each time it finds a difference in files. Each file is named as "OTA_[some_id]_[backup-timestamp]" .
I'm stuck at figuring out on how to make sure that the client syncs with the current data and doesn't need to re-sync the already synced compressed backup files.
NOTE: The client and server might not be running in the same timezones.
Use UTC or GMT for your timestamp so that it doesn't matter which timezones your client and server are in.