Search for files after a relative date using Windows search

Posted by Zoredache on Super User See other posts from Super User or by Zoredache
Published on 2010-03-14T22:26:52Z Indexed on 2010/03/14 22:35 UTC
Read the original article Hit count: 422

I am looking for a way to save a search that includes a relative date. Specifically I am looking for a way to save a search that matches files that have a modification date that is 7 days ago.

I have read the Windows Search Advanced Query Syntax document and I am not seeing a way to say 7 days ago.

The numbers and ranges section does mention that relative dates are possible. The problem is that the relative dates described there do not fit the criteria I need. The lastweek almost looks like what I want except if I run a query like after:lastweek on a Monday it will only show my file that have been modified since Sunday at 12:00. The lastweek/lastmonth seem to relative to the start of the week/month which is not what I need.

Multi-word relative dates: week, next month, last week, past month, or coming year. The values can also be entered contracted, as follows: thisweek, nextmonth, lastweek, pastmonth, comingyear.

One nice thing about saved searches is that they are stored as an XML document and the file format is documented. I am not seeing how to form a correct value for a datetime. If I was able to understand this format, I suspect I could use a text editor and created a saved search that does what I want.

Fragment from the examples:

<conditions>
  <condition type="leafCondition" valuetype="System.StructuredQueryType.DateTime"
             property="System.DateModified" operator="imp" 
             value="R00UUUUUUUUZZXD-30NU" propertyType="wstr" />
</conditions>

To summarize I am looking for an answer to one or both of these questions

  • How do I make a query for '7 days ago' using the standard syntax?
  • How is the DateTime stored in a saved search?

© Super User or respective owner

Related posts about windows-search

Related posts about date-modified