Overwriting newer zip files

Today I had a situation where I could not boot up. I used Clonezilla to restore a 2 day old image.

So my script which is in Autostart copied the zip files(July 31) from my main drive to my second drive.
And overwrote my files which were from Aug. 2.

I lost a lot of work.

Is there anything I can change in my script to prevent that again?

I think I need to compare the file date of Ubuntu_Documents.zip in sda1 with that of the one in sdb1.
And then decide whether to copy or not.

This is part of my backup script.

 cd ~/Documents
 zip -u -q Ubuntu_Documents.zip *.txt *.doc *.rtf *.html *.png *.pdf *.odt *.ods *.odg 
 cp -u -f Ubuntu_Documents.zip /media/andy/MAXTOR_SDB1/Ubuntu_Mate_18.04/

You can use the following command:

cp --force --backup=numbered Ubuntu_Documents.zip /media/andy/MAXTOR_SDB1/Ubuntu_Mate_18.04/

What this will do is that it’ll make numbered backups of your Ubuntu_Documents.zip file every time the script is run(like Ubuntu_Documents.zip~1~, Ubuntu_Documents.zip~2~ and so on).

I can see that you’re using the -u and -f flgs, that’s why your file in sdb1 is getting overwritten.