14

Does anyone know how to flush the disk write cache data from the cache manager for the current directory (or any given file or directory, for that matter), from a Windows command line?

sorin
  • 161,544
  • 178
  • 535
  • 806
Brian
  • 3,457
  • 4
  • 31
  • 41

1 Answers1

8

I found the SysInternals Sync worked well for me - although it flushes ALL cache, not just for the specific folder.

Example of usage:

IF EXIST Output RD /S /Q Output && Sync && MD Output

By default it flushes all cached data for all drives - you can specify command-line options to restrict which drives but you cannot restrict it to just specific folders.

Without it I would often get Access denied errors because the MD was trying to create a new folder while the system was still in the process of deleting the old one.

OldCurmudgeon
  • 64,482
  • 16
  • 119
  • 213
  • Thanks for the reply! I'm past this project now, but if someone else runs into this and finds that it solves the problem, please comment here and I'll mark this answer accordingly :) – Brian Apr 25 '14 at 16:48