Windows 2012 Script / Batch to delete 1 year old files EXCEPT FOR files within a directory
Posted on 2016-11-10
Is there a way to use a batch file / script to delete files and / or folders from a file server EXCEPT if the files are within a particular folder:
E.g. Folder structure is like:
Example, How to delete folder older that 365 days would be :
FORFILES /S /D -365 /C "cmd /c IF @isdir == TRUE rd /S /Q @path"
However, how to I put a EXCEPTION option to exclude E:\Storage\Accounts\Scans\Invoices and all subfolders and files?
Thanks in advance!