Backup strategy and bat file help

Dell / INSPIRON 9300
January 1, 2009 at 10:09:27
Specs: Windows XP, 1.86/1GB
Hi, I need help with part of bat file I want to use for backups. I can do most of it, it's the part below I need help with. The bat file will automate a Cobian backup to zip files and encrypt the files with Axcrypt. I encrypt them because next I will move the backup files to my online storage space manually using their application.

The situation:
1) only allows files up to 2GB to be uploaded so I'll use Cobian's ability to set a max size for each zip file and it will automatically span the backup across multiple zip files. I'll end up with 5-10 2GB zip files for a full backup.
2) I want to do full backups periodically with differentials between the fulls.
3) Other than by size, there is no way to tell if a backup zip file is a full or differential because Cobian doesn't allow to specify filenames for the zip files. (It names the files with the source, date and time of the backup. They advise using their log to tell which is which.) I can, of course, specify different folders to put them into.
4) My only scripting experience is with batch files/command line.

This is the part I need help with. To reduce upload time and save online space, I want to do differential backups until they get to a certain relative size, then do a full. So I'd like the bat file to check the size of the most recent differential backup (which will usually be in multiple spanned zip files named "The Source yyyy-MM-dd hh;mm;", and then .z01, .z02, etc) and when it reaches x% of the most recent full backup (also in multiple spanned zip files) I want it to automatically do a full backup instead. How can I get it to find which are the most recent backups, add the sizes of their spanned zip files, and compare their sizes with each other?

Thank you.

See More: Backup strategy and bat file help

Report •

January 1, 2009 at 18:46:26
OP here. In case it helps, I've found this much. This will get the size of a single file into a variable.

set filepath=c:\
set filename=testfile
set fileextension=.txt
dir /-c "%filepath%%filename%%fileextension%" | find "%filename%%fileextension%" > c:\temp.txt
for /f "tokens=1,2,3,4,5 delims= " %%i in ('type c:\temp.txt') do (set size=%%l)
echo The size of %filepath%%filename%%fileextension% is %size% bytes


Report •

January 2, 2009 at 00:00:04
It may be of some help for you to read this thread. (keep in mind it is only a couple of days old and still active.

Another way to get the file size in bytes that is much easier is:

for /f "delims=" %%a in ("drive:\path\filename.ext") do set size=%%~za

The file name can of course be made up from variables.

Report •

Related Solutions

Ask Question