2

I'm trying to locate only the hidden files in a given subtree of the file system. The search box in Windows Explorer has facilities for tags like

Date Modified:

or

Size:

Is there a similar tag for hidden? This:

Hidden: true

doesn't seem to work.

Any other alternatives to find only the hidden files?

Oliver Salzburg
  • 87,539
  • 63
  • 263
  • 308
MgSam
  • 121
  • See http://social.technet.microsoft.com/Forums/en-US/w7itproui/thread/fede1d8e-130c-4e69-9b2b-48cf3f904c43 for details. – Karan May 23 '13 at 14:28

2 Answers2

1

In the Windows Search, you should be able to use attributes:2.

The attributes are a bit field with the following values:

FILE_ATTRIBUTE_READONLY = 1
FILE_ATTRIBUTE_HIDDEN = 2
FILE_ATTRIBUTE_SYSTEM = 4
FILE_ATTRIBUTE_DIRECTORY = 16
FILE_ATTRIBUTE_ARCHIVE = 32
FILE_ATTRIBUTE_ENCRYPTED = 64
FILE_ATTRIBUTE_NORMAL = 128
FILE_ATTRIBUTE_TEMPORARY = 256
FILE_ATTRIBUTE_SPARSE_FILE = 512
FILE_ATTRIBUTE_REPARSE_POINT = 1024
FILE_ATTRIBUTE_COMPRESSED = 2048
FILE_ATTRIBUTE_OFFLINE = 4096
FILE_ATTRIBUTE_NOT_CONTENT_INDEXED = 8192

Just add the ones you're looking for together.

Oliver Salzburg
  • 87,539
  • 63
  • 263
  • 308
  • Unfortunately, I was not able to get this to work on Windows Server 2008 R-2. Perhaps on another version? – MgSam May 28 '13 at 13:43
  • @MgSam: Is the Windows Search Service role service installed on the server? It's part of the File Services role. – Oliver Salzburg May 28 '13 at 14:32
0

Open up PowerShell, navigate to the desired subtree, and run the following command:

ls -Force | ?{$_.mode -match "h"}
rtf
  • 12,686