A long time ago, I accidentally deleted the source to my Impossible Game with a batch file. Since I did it with a batch file, it didn't go to the recycle bin and was gone forever.
This is a backup technique that would have prevented that from happening. This won't protect you from hard drive crashes and the like, but it's so simple that you really have no reason not to do it.
Step 1:
Make a folder somewhere far away from your sources folder
My sources are C:\Asm\Sources so I made C:\Backups (a different drive would have been better, but oh well)
Step 2:
Edit your asm.bat (or whatever you use) to include this line to copy whatever source you are compiling into that folder
Mine looks like this:
@echo off
copy c:\asm\source\%1.z80 %1.z80 > nul
copy %1.z80 c:\backups\%1.z80 > nul -- this is the new line
spasm %1.z80 c:\asm\exec\%1.8xp
del %1.z80 > nul
time /T -- displays the current time, also a good idea
Done!
What this protects against:
- Deleting a source file
- Weird .bat file mistakes
- Deleting your source folder (!)
- Saving over your source file (as long as you don't assembling the new one)
What this doesn't protect against:
- Deleting everything in the file, saving, assembling
- Hard drive crashes
- Losing your computer
So, while this isn't the most thorough option, it would have prevented me from losing my source.