Free and Easy Daily Backup Solution
Update Read comments from user MWare below if you are having any trouble
So I wanted an easy and free way to backup my source code everyday. Well if you run Windows NT and have an Internet connection to download a copy of 7-zip you most certainly can backup your files regularly with unique filenames containing the date and time they were created - something that was a must for me. It helps if you have your source structured in a way that it all resides in a central location such as:
M:\XYZ Software\Source\Project A\
M:\XYZ Software\Source\Project B\
M:\XYZ Software\Source\Project C\
This way we can create a backup folder in the XYZ folder such as:
M:\XYZ Software\Source_Backup\
Then in XYZ Software place a copy of the 7za.exe file you downloaded and a batch file with the following code:
View the original version here (11/8/2005)
Every time this batch file is run from now it will generate a file in the Source_Backup folder like:
M:\XYZ Software\Source_Backup\2005-11-17-PM-11-04-Archive.zip
View version 2 here (3/15/2006)
This generates .7z files instead of .zip like listed below and is multithreaded for improved performance on multicore/multiprocessor machines. If you have a single core/CPU machine you may want to remvove the “-mmt=on” portion of the last line.
With the AM/PM setup this way when you sort by filename you will have your archives in the correct chronological order. Next simply schedule a task in Scheduled Tasks to run this batch file everyday at a given time. There you have it. Your own automated backup system. You could even add extra commands for AES encryption and then back it up off-site with FTP! Ah good old command line interface!
November 22nd, 2005 at 9:10 am
Nice script. Where can I find a good reference for batch file programming on NT?
December 5th, 2005 at 7:57 pm
no clue i had to dig up bits and pieces from all around the net
February 10th, 2006 at 9:20 am
http://www.robvanderwoude.com/batchfiles.html
http://help.fdos.org./en/index.htm
I know because I had to change the time parsing line to the following 3 lines (I guess my cmd.exe time format was slightly different):
for /f “tokens=1-2 delims=: ” %%e in (’time /t’) do (set hour=%%e& set minute=%%f)
SET AMPM=%minute:~2,1%
SET minute=%minute:~0,2%
February 10th, 2006 at 9:24 am
MWare do you have the US/English version of Windows or are you in 24 hour time format or something odd? It is weird that it didn’t work. I have been using my parsing method on a number of machines now for various things. Also are you on 2000/XP/XP 64/2003??
February 13th, 2006 at 3:54 pm
Yes, using US/English version of Win2000 pro.
Not set in 24hour format…
When I type >time /t on my command line I get
“3:51p”
(No colon between the ‘1′ and the ‘p’… so it cannot delimit the min from the AMPM).
February 13th, 2006 at 4:07 pm
Interesting thanks for the info! Hopefully people will read these comments. I’ll put a note to read comments from MWare
February 15th, 2006 at 9:01 am
I created a link here from the main menu as this is one of the more popular and useful posts
March 15th, 2006 at 8:12 am
I recently revisited this idea and made some changes to save on space. The portion of code I backup everday went from 17MB down to 6MB! The new version is also multithreaded for multicore/multiprocessor machines (though I tell you how to disable it for single core/cpu systems. View version 2 above.