1

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?

2

I just tried and got the same results. I was able to get the file to show up by unchecking Hide protected operating system files. It looks like when these types of files are hidden, they are automatically set as operating system files. Therefore you need to show/unhide those as well.

If you wish to learn more about the file type: What type of file is ~$file?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.