Drive Space for local backups (local mean QUICK backups) can get ownerous and it constantly needs user interaction. Well lets put a stop to that and fullfill a dream I have.
- a) cull either on a date or file limit basis
- b) cull rules are to keep
- last item in the year
- last item in the month
- last day in the week
- last hour in the day
So a way to start is to simply
- make a file list
- mark the end of all the years, months, weeks, days and hours
- delete all else until our time or date criteria is met
Lets get going … Now in real life, there will be 2 criteria – lets say 2 limits – an in between these limits
- we move the files to another location B instead of deleting them
- then the delete criteria will be on location B or – rerun the whole thing and perform a delete on B but a move on the initial location
To be safe, I will either make a text output or if I am smart – a bat file output – that if required will be easy to run if I like it. THen wrap the whole thing up in a .bat file and schedule it. Remember I have an article on running .exe programs from the scheduler that will be required.
A site that mentions an old way to do it – but this was .net 2.0 (see msdn kb article too). Since I am doing this on a local machine – this is overkill. They recommend DriveInfo and lets see what it has now that we are .net 4.5. We are going to NOT worry about disk quotas etc- so we will be looking at the DriveInfo.TotalFreeSpec