I am trying to use Windows Explorer's Advanced Query Syntax to search for song files in a folder that are less than 10 seconds long. I tried the following statement, but it returns everything.
kind:=music length:<=00:00:10
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.
Sign up to join this communitySorry but that is not a valid AQS argument for length
search. There are only 5 supported arguments for that search, and they pop up when typing length:
You could see if an argument is valid, since it'll got blue, while your search code stayed black. See difference:
I originally landed on this page because I was trying to find out how I could search for videos that were less than 15 minutes long and were overlarge (>100MB) due to poor encoding.
When I read the "Feb 3, '16" answer to Rick's question, I thought "No way, not even MS could be that dumb" (although I have to admit to being a touch worried about that!).
Surprisingly, it turns out I was right, but it still took me a while to figure out this kind of multiple property search for myself. It is (almost) as easy as Rick's original query (i.e., kind:=music length:<=00:00:10); you just can't search by length / duration of a media file using hh:min:sec.
The property being queried is "System.Media.Duration", which according to MS "represents the actual play time of a media file and is measured in 100ns units, not milliseconds" (see, https://docs.microsoft.com/en-us/windows/desktop/properties/props-system-media-duration). Not sure why they chose this seemingly arbitrary scheme, but I imagine it has something to do with the way computers store numbers (or, more likely, stored numbers in the past).
At any rate, in order to conduct my search for videos less than 15 minutes long, I had to convert 15 minutes into nanoseconds (= 900000000000 or 9e+11) then divide the result by 100 (= 9000000000 or 9e+9).
The query in the Windows search box reads:
length:<=9000000000 (guess what? it turns BLUE). If I then add "kind:=video" and "size:>100mb" to the search box, I find the videos I need to re-encode.
To go back to Rick's original question, in order to find items that are music AND 10 seconds or less in play length, the query in the Windows search box should read:
length:<=100000000 kind:=music (10 seconds = 10 billion ns / 100 = 100 million units of '100 ns' = 1e+8)
It should be possible to use this query on any media file supported by the "System.Media.Duration" property. It works for sure on video and audio (I'm not sure what else there is!).
To easily convert your time into 100 ns blocks, use a G00gle search box: set the time units you're looking for (minutes, seconds, etc) with the drop-down, then put your "# units/100" in the left box (in Rick's case: set the drop-down to seconds, then put "10/100" in the left box). Then set the right drop-down to nanoseconds and voila, you get the number to use in the Windows search query (probably in scientific notation) in the right-side box.
If you really want to get crazy (and kind-of make the first answer to this question correct), I imagine you could change the values for "very short, short, etc..." in the registry. The appropriate Windows Property Settings are described at the link above (which is where I finally discovered the correct answer to Rick's question, and mine).
RSQ@MAGS