DirTree - Query Parser

Intro

Simple, semi-natural language query for filtering filing system objects.
The basic query is in the form of <field> <operator> “<meta data>”.
The quotes are required for all fields.
Queries can be bracketed.

Q1 & (Q2 | Q3) & ((Q4 & Q5) | Q6)

name beginsWith “Z” & (logSize < “1kb” | logSize > “1PB”) & ((created.hour = “12” & accessed.hour < “4”) | path contains “blob)

Fields

Describes the fields, the operators that work with the field and the metadata format.

Name

Filing system name of the object. This is not the display name as shown in the Finder (and other applications). And the extensions are visible.

Operators
beginsWith, endsWith, contains, dnc*, <, ≤, <=, =, is, !=, ≠, isn’t, >=, ≥, >
* does not contain

Metadata
Almost all characters the filing system can accept. The string must be convertible to UTF-8 format (usually not a issue).
To enter a “ as part of the string, use \” . e.g. “quote\”blah”.

Entry text : name
name contains “axe”
name is “job”

Path

Full path of the object. Symbolic links and aliases are not resolved.

Operators
beginsWith, endsWith, contains, dnc, <, ≤, <=, =, is, !=, ≠, isn’t, >=, ≥, >

Metadata
Almost all characters the filing system can accept. The string must be convertible to UTF-8 format (usually not a issue). To enter a “ as part of the string, use \” . e.g. “quote\”blah”.

Entry text : path
path contains “axe”
path is “job”

Type

What filing system type the object is.

Operators
=, is, !=, ≠

Metadata
One of the following: fifo, char, dir, directory, folder, block, symlink, symbolic, link, sym link, sock, socket, whiteout.

Entry text : type
type is “block”

Dates

There are five different date fields : created, content modifier, attribute modified, backuped & last accessed.

Each field can append a sub-component for more flexible filtering

Operators

<, ≤, <=, =, is, !=, ≠, isn’t, >=, ≥, >

Metadata

For all

The following uses the creation date for informational purposes. The information also applies to content modification, attribute modification, accessed and backuped. Entry text is what you put into the query.
Replace 'created' with 'cntModified', 'attrModified', 'backuped' or 'accessed' when reading the entry text format for the other date fields.

Created
“YYYY/MM/DD.HH:NN:SS”, “DD/MM/YYYY.HH:NN:SS” M, D, H, N, S can be one or two digits. Y must be four digits.

Entry text : created

Creation Date
“YYYY/MM/DD”, “DD/MM/YYYY”
M, D can be one or two digits. Y must be four digits.

Entry text : created.date

Creation Year
“YY”, “YYYY”
For YY, the value is added to 2000

Entry text : created.year

Creation Month “mM”, “mMM”
The leading ‘m’ is required. Range is 1-12.
"jan", "january", "feb", "feburary", "mar", "march", "apr", "april", "may", "jun", "june", "jul", "july", "aug", "august", "sep", "september", "oct", "october", "nov", "november", "dec", "december"

Entry text : created.month

Creation Day
“dD”, “dDD”
The leading ‘d’ is required. Range is 1-31.
"sun", "sunday", "mon", "monday", "tue", "tuesday", "wed", "wednesday", "thu", "thursday", "fri", "friday", "sat", "saturday"
Entry text : created.day

Creation Time
“HH:MM:SS”
H, M, S can be one or two digits.
H range is 0-23. M range is 0-59. S range is 0-59.

Entry text : created.time

Creation Hour
“HH:”, “HH”, “midnight”, “midday”
H can be one or two digits.

Entry text : created.hour

Creation Minute
“:NN:”, “NN”
N can be one or two digits.

Entry text : created.minute

Creation Second
“:SS”, “SS”
S can be one or two digits.

Entry text : created.second

Owner ID

Owner ID of object.

Operators
<, ≤, <=, =, is, !=, ≠, isn’t, >=, ≥, >
Metadata
“XX”, “XXsfx”

X is any integer >= 0.
sfx is one of the following suffixes

Entry text : ownerID

Group ID

Group ID of object.

See OwnerID above.

Entry text : groupID

File ID

FS ID of object

See OwnerID above.

Entry text : fileID

Parent ID

Parent directory ID of object

See OwnerID above.

Entry text : parentID

Logical Size

Logical size of object. Includes resource fork.

See OwnerID above.

Entry text : logSize

Physical Size

Physical size of object. Includes resource fork.

See OwnerID above.

Entry text : phySize

Valence

Number of items in directory.

Does not include ‘.’ & ‘..’.

Does include hidden objects.

See OwnerID above.

Entry: valence

Immediate Logical Size

Total logical size of all child components. Does not burrow into sub-directories.

See OwnerID above.

Entry text : immedLogSize

Immediate Physical Size

Total physical size of all child components. Does not burrow into sub-directories.

See OwnerID above.

Entry text : immedPhySize

Data

Actual data content of a file.

This is not yet implemented.

A query with this field will only search files, never any other filing system object.

Operators

These are all the operators:

beginsWith endsWith contains dnc < <= ≤ = is != ≠ isn’t >= ≥ >
Name
Path
Type
Dates
Numeric Fields
Data