jpenn Posted August 19, 2009 Posted August 19, 2009 Now then fellow techies, I have a new problem, Thanks for everyone's help on the last one. Ok I am looking for a script which will delete Incremental backup's of a certain age i have found a few online while searching but nothing that seems to be quite right. Basically i do one full backup per week and then incrementals each day i would like to delete any backups older than say 4 weeks old. Any advice would be most appreciated as my scripting skills add up to zero. Cheers People Jon
IrritableTech Posted August 19, 2009 Posted August 19, 2009 I dont remember where I found this... but found it useful. Dim i, fso, f, f1, sf, BasePath, CalcResult, fNameArray() BasePath = "T:\Backup Directory\" Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.GetFolder(BasePath) Set sf = f.SubFolders For Each f1 in sf CalcResult = DateDiff("d",f1.DateCreated,Now) if CalcResult > 30 then ReDim preserve fNameArray(i) fNameArray(i) = f1.Name i = i + 1 end if Next For Each fName in fNameArray FSO.DeleteFolder(BasePath & "\" & fName) Next You should just need to change the BasePath, and the number of days old (CalcResult > 30). 1
jpenn Posted August 19, 2009 Author Posted August 19, 2009 Very nice! and a very quick reply thank you. Now i find myself with another problem. We need to have some backup data going back 3 to 4 weeks but i am running incremental backups set to append not replace, unfortunatly the append option is just making one big backup with no way that i can see to delete anything. Am i missing something, am i just being completley stupid. Think i've spent to much time googling this. please help!!!!
IrritableTech Posted August 19, 2009 Posted August 19, 2009 To be honest (although I'm not a big fan of NTBackup) I would probably set jobs up something like this... Week 1 Saturday - Full Backup - Replace - Run every 28 days - First Run 22nd August - Called Week 1 Full Monday Night - Incremental - Replace - Run every 28 days - First Run 24th August - Called Week 1 Monday Inc Tuesday Night - Incremental - Replace - Run every 28 days - First Run 25th August - Called Week 1 Tuesday Inc Wednesday Night - Incremental - Replace - Run every 28 days - First Run 26th August - Called Week 1 Wednesday Inc Thursday Night - Incremental - Replace - Run every 28 days - First Run 27th August - Called Week 1 Thursday Inc Week 2 Saturday - Full backup - Replace - Run every 28 days - First Run 29th August - Called Week 2 Full Monday Night - Incremental - Replace - Run every 28 days - First Run 31st August - Called Week 2 Monday Inc Tuesday etc etc. Week 3 Saturday - Full backup - Replace - Run every 28 days - First Run 5th September - Called Week 3 Full etc etc. Week 4 etc etc. It does mean setting up 20 jobs in the calendar, but the time you put in now saves time later. I hope it makes sense. 1
jpenn Posted August 19, 2009 Author Posted August 19, 2009 Yeah i understand it nice i will put it to the boss and see what he has to say!!
jpenn Posted August 20, 2009 Author Posted August 20, 2009 I seem to have got myself in a pickle yet again. Following your instructions was going great but as i could not find an option to repeat every 28 days i was telling to do it on every last monday, last tuesday etc. But my plan fell apart when because of the differences of days in a month the weeks became inter-mingled with each other. Oh for a really world class Head doctor right now. my brain is fried help!
leco Posted August 20, 2009 Posted August 20, 2009 I seem to have got myself in a pickle yet again. Following your instructions was going great but as i could not find an option to repeat every 28 days i was telling to do it on every last monday, last tuesday etc. But my plan fell apart when because of the differences of days in a month the weeks became inter-mingled with each other. Oh for a really world class Head doctor right now. my brain is fried help! In the settings dialogue check Weekly, then just beneath that set Every 4 weeks (i.e. 28 days). Incidentally the Advanced button next to the date leads to a dialogue where the start date can be set. Hope that helps. 1
IrritableTech Posted August 20, 2009 Posted August 20, 2009 In the settings dialogue check Weekly, then just beneath that set Every 4 weeks (i.e. 28 days). Incidentally the Advanced button next to the date leads to a dialogue where the start date can be set. Hope that helps. Or you can choose 'Daily' and select every 28 days. Sorry if I was unclear. 1
jpenn Posted August 21, 2009 Author Posted August 21, 2009 Right thats all set up. Thanks for the help again guys and gals where would i be without you lot. Only one more issue !!!!!!!! Just hope i've got enough space for all these backups.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now