windows powershell delete files older than with exclusions
Posted on 2013-06-09
I'd like to delete files and sub-folders older than 14 days while excluding specific folders.
main path: C:\Projects
under c:\Projects there are subfolders with project names, 1 folder for each project.
I'd like to KEEP the 1st level of all folders, meaning, keeping all projects folders while deleting only their content (files+folders) older than 14 days (all depth-levels), lastly, I'd like to be able to specify in the script certain paths\folders which will remain intact, including their contents.
Any chance someone here is able to write that script?