locked
Windows Search Advanced Query Syntax (AQS) and File Attributes RRS feed

  • Question

  • Filtering for files in Windows Explorer was introduced in Windows Vista but is gone from Windows 7. Now we are supposed to use Windows Search box to build a query and use it instead of filtering. My question is how to search or filter by files attributes. Say I want to see only Hidden files in my folder or exclude files marked as archived.

    I've checked the following two guides. There are quite a lot of properties we can filter by. But attributes are not among them.

    Thanks in advance.

    Tuesday, September 1, 2009 1:12 PM

Answers

  • Someone mentioned below that there's a popup displaying the attributes list but didn't spell out what those values were, so I'm going to go the extra step just in case that list isn't populating for you and so future web searches can actually show the values:

     

    attributes:16    is D

    attributes:32    is A

    attributes:33    is RA

    attributes:34    is HA

     

    I'm sure there are others, but that popup seems to only give you the attributes that are present among the files that are in the dir you're searching so this list is incomplete.  It would be nice if it was provided on the web somewhere - a good place would've been among those syntax links above.

     

    Thursday, October 7, 2010 7:54 PM

All replies

  • I'm trying to figure out how to do this too.  Anyone figure it out?  Can it be done?
    Tuesday, November 10, 2009 4:09 AM
  • In Windows Search type: 'attributes:' without the quotes, and wait one second; you should now see a list of attributes you can choose from. Just figured this out by trial and error.

     

    Monday, July 5, 2010 9:28 AM
  • Someone mentioned below that there's a popup displaying the attributes list but didn't spell out what those values were, so I'm going to go the extra step just in case that list isn't populating for you and so future web searches can actually show the values:

     

    attributes:16    is D

    attributes:32    is A

    attributes:33    is RA

    attributes:34    is HA

     

    I'm sure there are others, but that popup seems to only give you the attributes that are present among the files that are in the dir you're searching so this list is incomplete.  It would be nice if it was provided on the web somewhere - a good place would've been among those syntax links above.

     

    Thursday, October 7, 2010 7:54 PM
  • It seems to be a bits sequence.

    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

    More info: http://ss64.com/nt/attrib.html

    You can mix the values.

    You can also use the letters, for example: attributes:RH

     

    Wednesday, September 21, 2011 6:43 PM
  • I have been trying out the information on this page, but didn't get it working. I would like to add some information, based on Windows 7 Ultimate 64 bits, about what works for me at the moment. But I am also still figuring out the whole picture. I needed to find the non-encrypted files in a folder structure of mostly encrypted folders and files, on a non-indexed external usb drive. Attributes:E or Attributes:AE did not work. I accidentily got some clues from Windows 7 by searching in an indexed folder. Typing in 'Attributes:' resulted in Windows 7 showing the attribute combinations that were present in the current folder and subfolders. By compressing a test file in an search indexed folder, windows showed me that the search filter was 'Attributes:16416'. Now 16416 decimal corresponds to X4020 hex, which is a combination of X40 and X20 (64 for 'encrypted' and 32 for 'archive'). Is that a coincidence? I was not able to construct other combinations that worked... Anyhow, my tip is: try this out on a controlled situation in an search indexed folder, and than use it in a non-indexed folder where necessary. I hope this is of use to anybody.
    Friday, October 7, 2011 1:56 PM
  • Note, 2nd link now goes to Win XP download page.

    Unless using in porgramming, may also want to add these to your list:

    MSDN Article about Advanced Query Syntax (AQS)

    http://msdn.microsoft.com/en-us/library/aa965711(VS.85).aspx

    and

    MSDN Windows Search Overview article:

    http://msdn.microsoft.com/en-us/library/aa965362(VS.85).aspx

    Thursday, June 21, 2012 12:49 AM
  • FILE_ATTRIBUTE_ENCRYPTED = 64 is WRONG

    FILE_ATTRIBUTE_ENCRYPTED = 16384 

    Wednesday, July 5, 2017 4:52 PM
  • It might be in order to explain the above values for those who don't already know:

    Each attribute is set by flipping on a bit. Each bit has a value:
    Read-only (R) value is 1 + Archive (A) value is 32 = RA value of 33.
    Hidden (H) value is 2. HA is a combination of 2+32 = 34.
    Directory (D) value is 16.

    If you want to find all read-only files, you can't simply search for the R value of 1, you must at least search for RA, or 33. However, searching for read-only (RA) will not reveal files which are both read-only and hidden (RAH). The following arguments will show most files which are set to Read-only and Read-only/Hidden:

    attributes:35 OR attributes:33
    
    The OR must be capitalized, and you may add as many additional arguments as you like.

    None of this is very intuitive, and it seems there many other attributes which might be added to the above values and defeat your search. It's difficult to find a definitive list of potential attributes which also shows their values.

    As powerful as AQS is, I've found no apparent way to check JUST the read-only bit or just the hidden bit. Perhaps someone else can chime in if they know?



    • Edited by YenFai Wednesday, January 24, 2018 3:50 PM
    Wednesday, January 24, 2018 3:46 PM