Making a folder unsearchable...

Status
Not open for further replies.

zealengine

Distinguished
Dec 7, 2009
77
0
18,630
I was under the impression that "attrib +s folderName" would make a folder in Windows7 unsearchable. However, I just tried it and the contents are still showing up when searching the root directory (using the little search box in the upper right corner of the explorer window). What am I doing wrong? Is there some other way to make a folder unsearchable?

Thanks
 
Gah this is driven me nuts. If you google "make a folder hidden and unsearchable windows 7" there are 8 billion tutorials, and they all say the same thing, use "attrib +s +h folderName", which does indeed HIDE the folder, but the contents STILL show up in a search. How can there be so many tutorials that just don't work (clearly it must be something on my end, but what!?).
 
There may be something under security settings that may prevent it from being searched.

I experimented with this and had the same outcome that you did so I changed the attributes on the file to +s +h and the file did not appear during a search. However, if "show hidden files and folders" is enabled the folder can be seen but not the file.
 
had the same outcome that you did so I changed the attributes on the file to +s +h and the file did not appear during a search.

Huh? So the command DID work for you? For me it just makes the folder disappear, but the contents will still show up in a search.

Can anyone confirm they HAVE gotten this to work in Win7, and the steps you took?
 


Yes, it worked in Windows 7. To get it to work I had to set the both the file and the folder attributes to +s and +h. I had to make sure that "Hide protected operating system files." was enabled. I used the following steps to accomplish this in Windows Explorer:

1. Click on Tools
2. Click on Folder Options
3. Click on the View tab.
4. Make sure there is a check beside "Hide protected systmem files (Recommended)".
 
AHHH so ALL the files need to be flagged with +s? Thats going to be a major pain to remember to do that as new files are added to the folder. Is there no way to just set all contents of the folder (existing and new files) as system files?

There has got to be some way to make folder contents unsearchable...
 
You shouldn't need the +s as that marks it as a system file. All you need is the +h for hidden. As stated above, if you have your file options set to "show hidden files", you'll still see them. The "hide protected system files" hides the files with the +s system attribute where as the "show hidden files" will show the +h hidden attribute. This only takes effect in the file explorer. I think a search will still turn them up, after all, when you are searching it shouldn't matter what the file attribute is, you just want it found.

Also, the hidden attribute will hide files when you use a "dir" command from a command prompt.
 
I think a search will still turn them up, after all, when you are searching it shouldn't matter what the file attribute is, you just want it found.

Yeah thats kinda the whole point of this thread. Even with +h and +s files are still showing up in a search. Do not want.

I just dont understand why flagging a folder as +s+h doesnt apply that setting to all the files inside. I mean, whats the point of running the command on a folder then?

Has anyone been able to figure this one out yet?
 


If you want to do all files and subfolders, you also need the /S flag.

ex. attrib +h <folder_name> /S

I think you can also use wildcards.

ex. attrib +h c:\temp\config*.*
 
Yeah but will that work when a NEW file is added to the folder? I am trying to make this simple, I dont what to have to remember to run a batch file every time I add a new file to the folder.
 
Well I cant even get it to work, the /S always returns with "File not found - 'directoryname'". I HIGHLY doubt it would apply to new files as they are added to the folder anyway.

I noticed there is a option in controlpanel->folder options to "Include system folders when searching for files.". Which I unchecked. I was SURE this would do it. But of course, files in the folder still show up (even after it has been marked +s). Garr why is there an option to disable "Include system folders when searching for files.", if its not going to do what it says! Can anyone else confirm that setting is just plain broken?

* a million points to anyone who can get this to work. This should be SO simple, its driven me nuts...
 
+h is hidden which means they won't show up in a listing at all unless you have explorer set to "show hidden files". +s is a system file, but you will be in the same boat since explorer won't show system files unless you turned on "show system files".

I don't know how search works. It didn't show the hidden files for me. I did not try system files as I don't like marking files as system files unless they are actually a system file, like a required DLL file or something.
 
Yeah so with your method, I would have to turn "show hidden files on", access the folder, then remember to turn it back off (which I will always forget to do). Thats not gonna work.

I dont mind flagging a folder as a 'system folder', but the problem is that damn 'dont search system folders' option just seems to be BROKEN. Has anyone ever been able to create a unsearchable system folder by unchecking that "Include system folders when searching for files." option?
 
Ok were getting closer! After doing some testing I found that when doing a search from root c win7 WILL indeed skip "system" directories like 'c:\windows'. However, if you navigate into 'c:\windows', search works as expected. THIS IS THE EXACT BEHAVIOR I WANT ON MY FOLDER. So, the problem seems to be, 'attrib +s foldername' does NOT appear to be creating a 'true' system folder. Perhaps there is some master list (in the registry maybe) that defines 'c:\windows' as a true 'system' directory?

*it also appears that the program files folder is also flagged as 'system' and is ignored during root searches. However, I tried copying the folder (thinking it would retain its 'system' status), but the copy was treated as a normal (searchable) folder. There MUST be some way to add my custom folder to a 'system folder list' in the registry, right?
 


Why would you to change settings to hide and unhide under YOUR account? You already know the files are there and hidden. This makes no sense. Turning on "show hidden files" will only do it for your account. Other accounts shoudn't be able to see them when logged in unless they change their folder settings.
 
Here is how I did it. I created a .bat file that will apply the hidden and unhide functions for me.

To hide: (hide.bat)
@echo off
cd C:\Users\Me\Documents\
attrib +s +h <folder to hide>\*.* /S /D
attrib +s +h <folder to hide>
EXIT

Save this as a something.bat. I used "hide.bat". This bat file can be placed anywhere in your computer and it will run the proper commands to make your files unsearchable and hidden. I did this w/ windows 7.

To unhide so you can access it again: (show.bat)

@echo off
cd C:\Users\Me\Documents\
attrib -s -h <folder to hide>\*.* /S /D
attrib -s -h <folder to hide>
EXIT

Worked for me!
 


Thanks, works for me too :) Just remember to put this bat file on the correct drive of your folder.
 
Well It is a command line utility for changing various access controls on a file or folder.

1.Make a Folder in any drive and store your private data inside it. here for example let the folder name is ‘private’.

2.Open Windows command prompt: ‘ Start >> Run >> cmd ‘

3.Set your Drive and Directory where you make your folder.If you are not familiar with the command line commands, then use ‘cd ..’ to go one level upwards and ‘cd folder_name‘ to go one level down. This should be enough to get you to the right folder.

4.In command prompt type the following syntax:

cacls <folder name> /e /c /d %username%

For instance in this article the command should be

cacls yourFolderName /e /c /d %username%

That command will make the folder “Private” inaccessible and un-deletable.

5.Now when you want to access the folder for your need then type the following syntax in the command prompt and hit “Enter”:

cacls <folder name> /e /c /g %username%:f

This will return the folder in its normal form.

This trick works in both Windows XP, Windows 7 as well as in Windows vista. But the file system
 
Well, I came here looking for a more flashy useful solution but A really stupid simple way is make a ZIP folder, yeah that's all you need, windows won't pull up any file name or anything from the ZIP file so just name it something inconspicuous to throw people off, and hide it somewhere, the huge and annoying problem with this method is if you need constant access to the files and or they are rather large files, or a large amount of files, because you need to unZIP or wait for them to open from the zip folder
 
Status
Not open for further replies.

TRENDING THREADS