Greetings!
I have a script which makes backups using Windows server backup. A script creates a folder DD-MM-YYYY and put the backup into this folder, soo every next day it creates a different folder with DD-MM-YYYY name.
Now I am searching an idea (a powershell command) which would leave only the last three backups.
For example If I have folders:
06-09-2013
13-09-2013
20-09-2013
27-09-2013
04-10-2013
...
Is there a way to make a script which would leave only the last three folders (for example: it would leave 04-10-2013,27-09-2013,20-09-2013, but delete the other subfolders and their contents/subfolders)?
bostjanc