Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find most recently created files, add file sizes and compare sums

Status
Not open for further replies.

homer70

Technical User
Aug 20, 2006
16
US
Hi,
I'm trying to get a bat file that decides which kind of backup to do by comparing the sizes of the most recent full and differential backups.

This is what I am working with:
1) I store copies of my backups online. Due to my online storage provider's 2GB file size upload limit, I use Cobian Backup's ability to set a max size for each backup zip file so it automatically spans backups across multiple zip files. I end up with 5-10 2GB zip files for a full backup.
2) Cobian Backup names their backups the same way whether it is a full or differential backup. They advise using their log to tell which is which. The only way to tell which is which is to look at their the size, so I put fulls into a folder called Fulls and differentials into a folder called Diffs.
3) Cobian names the files "SourceFolder yyyy-MM-dd hh;mm;ss.zip" then the spanned files' extensions begin .z01, .z02, etc. with the same filename as the original.

I want the bat file to do differential backups until they reach 50% of the size of a full, then do a full instead. This is what I've go so far, but it only gets the size of one file into a variable so there's still a long way to go...

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
pause

I have WIndows XP. Thank you for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top