I've been experiencing the following issue.
I have a database attached to a remote sql server. All needed impersonation actions are done - in other words I have all needed access to both file system and sql server.
Let's say I have FileStreanDB1
sql database:
\\server\C$\MSSQL\Data\FileStreamDB1.mdf
\\server\C$\MSSQL\Data\FileStreamDB1_log.ldf
\\server\C$\MSSQL\Data\FileStreamDB1
At some point I would like to drop this database. So I just use the following sql statement (I call this code using c#):
DROP DATABASE [FileStreamDB1]
After that the database is deleted and all files are deleted as well (If I go to that server I don't find them - files and directories are really deleted).
But unfortunatelly the following code says to me that \\server\C$\MSSQL\Data\FileStreamDB1
still exists.
new DirectoryInfo(@"\\server\C$\MSSQL\Data\FileStreamDB1").Exists // returns true
Directory.Exists(@"\\server\C$\MSSQL\Data\FileStreamDB1") // returns true
It looks like that info about the directory cached and I need to clean that cash (SMB2 Directory Cache and I DO NOT WANT TO DISABLE IT)
I've also tried to do that:
new DirectoryInfo(@"\\server\C$\MSSQL\Data\FileStreamDB1").Refresh().Exists // return true
Any ideas how I can clean windows cache about unc paths using c# ?