Skip navigation

JSI Tip 0483 - How can I hide files from Explorer and/or Dir?

If you want to hide files from everyone and you have an NTFS partition, you can do it by using streams. NTFS allows a file to have multiple streams using <filename>:<StreamName> syntax.

Open a CMD prompt and type:

notepad "MyFile.txt"

You will be prompted to create it. Click Yes. Enter some text and save the file. Do a DIR and record the size of the file. Now type:

notepad "MyFile.txt:secret"

You will be prompted to create it. Click Yes. Enter some text and save the file. Now type:

notepad "MyFile.txt

:HideMe"

You will be prompted to create it. Click Yes. Enter some text and save the file. Now type:

DIR MyFile.txt

You will see that the streams are invisible and that the file size is the same as you originally recorded. Likewise, you will not see them in Explorer.

You may read/edit your data by typing:

notepad "MyFile.txt

:secret"

The only way I know to remove the streams is to copy the file to a FAT partition and then back again:

Copy MyFile.txt A:\
Copy A:\Myfile.txt MyFile.txt

A copy from an NTFS partition to an NTFS partition will preserve the streams.

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish