The EPDM API command IEdmClearLocalCache will allow you to clear the local cache of folders and/or files.
There is a nice example in the help file showing you how to add folders to the selection of folders to clear. Perhaps you recursivly go through all folders in the vault (except the ones you don't want cleared.) and add them to their list.
Also look at this thread https://forum.solidworks.com/thread/36562
Thanks Jeff. I will give this a try.