How can I stop files hidden using `attrib +h +s somedir` from showing in searches?

2

1

I use Windows 10 and I've hidden a folder using attrib +h +s C:\MyUser\HiddenDir\ which contains some files like MySecretDocument.docx.

I have Folder Options set to Show hidden files & folders so I can still see the likes of MyUser/AppData from the MyUser directory listing. However HiddenDir is invisible from the same file listing.

When I search C:\ or C:\MyUser for *.docx; the secret files still show up! How can I hide them from the search results?


The above is the most important. The following is not as important since I've found a workaround. The files and folders also show up in Quick Access. How can I hide just this folder from it? The only way I've found is to hide all files, e.g. Folder Options > [Uncheck] Show recently used files in Quick Access and Folder Options > [Uncheck] Show frequently used folders in Quick Access.

Edward Snowden

Posted 2015-10-05T00:50:40.693

Reputation: 21

Prime example of why security by obscurity never quite works... – Fiasco Labs – 2015-10-05T01:45:19.623

Why not just also attrib +h C:\MyUser\HiddenDir\MySecretDocument.docx ? You only wants to hide it from your normal Windows Explorer search results, right? – Explorer09 – 2016-10-05T15:37:48.760

@FiascoLabs but the OP was after privacy, not security. Privacy and obscurity do in fact go hand in hand. – andromeda – 2017-07-25T15:46:02.810

Answers

0

Combine these two processes:

  1. Un-index the folder from windows search as follows: Go to start button Search for 'indexing options' Click the modify button and uncheck the folder you don't want to have searched and save your changes.

  2. Hide the folder by creating 2 .bat files within your folder as follows...

Create your .bat files

@echo off
cd E:\mySecretFolder
attrib -s -h .\*.* /S /D
attrib -s -h .
EXIT

Save this file as hide.bat

@echo off
cd E:\mySecretFolder
attrib +s +h .\*.* /S /D
attrib +s +h .
attrib -s -h .\show.bat
attrib -s -h .\hide.bat
EXIT

Save this file as show.bat

Click on the hide.bat file to hide all the files in mySecretFolder

To show the files again, click on the show.bat file.

Make sure you change E:\mySecretFolder to your desired path.

Once the parent folder is hidden, the only way to access it is through the folder path atop your explorer window or through the commandline. cd into it and type explorer .

andromeda

Posted 2015-10-05T00:50:40.693

Reputation: 101

-1

The hidden attribute hides files and folders from a normal search. The usual purpose is to prevent clutter in folders and to some extent to prevent accidental removal of files created by applications to store preferences, etc. Hidden files and folders are not a security measure.

If you want to prevent others from seeing your files consider using encryption. You can apply whole disk encryption - e.g. BitLocker - or you can create an encrypted volume using a utility - e.g. VeraCrypt. VeraCrypt can also create a hidden volume within an encrypted volume, but it's possible to detect the presence of the hidden volume.

Wayne Johnston

Posted 2015-10-05T00:50:40.693

Reputation: 3 416