OS: Windows 8.1
While programming I needed to create a hidden file. Like MS Word does when you open a document you see a ~$documentname.docx
file that is hidden. So I created a file ~$anything.extension
and made it hidden. While viewing the directory in Windows Explorer I was able to see the file. Once I hit F5, the file disappeared. First I thought my code was doing something weird and deleting it, but my code would find the file using File.Exist
. I can see the file in command prompt running dir /a
and I can open it and see the contents of the file. But if I try del "~$name.extension"
it can't find the file.
I've also noticed you can replicate the same behavior by just opening a MS Word document and you will see the ~$document.docx
hidden file. Then if you F5 in the directory it will disappear.
My question is: Why does giving the prefix of ~$ and hidden attribute make the file disappear even though you have hidden items showing in the settings? Is this suppose to be expected behavior?