Note: the %temp% directory, at this time, is something like "c:\users\xxxUSERxxx\AppData\Local\Microsoft\Office\15.0\OfficeFileCache"
cd %temp%
cd ..
cd microsoft
cd office
cd 15.0
cd OfficeFileCache
dir
forfiles /m *.fsd /d -1 /c "cmd /c del @file : date >=
1 days >NUL"
forfiles /m *.fsf /d -1 /c "cmd /c del @file : date >=
1 days >NUL"
pause
This script tries to avoid any currently opened files by starting with yesterdays files (and older.) Technically you could just delete everything with *.* and windows will just ignore all the files that are open because OneDrive is trying to sync them at the moment and has them locked. What I'm trying to avoid with my approach is to avoid deleting the "CentralTable.xxx" files that OneDrive is using to manage the file syncing.
On a related note, When you run a repair on OneDrive it creates *.Oldx versions of your OfficeFileCache folder in the %temp%\microsoft\office\15.0 directory with folder names like OfficeFileCache.old1, OfficeFileCache.Old2. These are copies of the folders before the repair executes. These can be deleted - if you are comfortable with the files you have on your OneDrive locally and in the cloud.
Cheers,
Carlos
Cheers,
Carlos