# bm-match configuration + rules


# Use `bm-match FILES` in this directory to match the files against the rules 
# in this configuration. 


# Commands are separated on a line. Empty lines and lines starting with #
# are ignored. Variables are set with the 'set' command.



# You can specify an arbitrary bookmarks file with the bookmarks variable.
# The path can be relative or absolute.
# set bookmarks = .bookmarks

# Log levels:
#  0 ERR
#  1 WARN
#  2 INFO
#  3 DEBUG

set loglevel = 2



# The threshold is the minimum weight a match needs to be taken into account.

set threshold = 1.0



# These commands are executed after a match has been found.
# Variables:
#   %file%         The matched file
#   %match%        The destination directory
#   %bookmark%     The destination bookmark/directory



# exec_best is only executed on the best match

set exec_best = echo %file% %match%

#set exec_best = mv %file% %match%


# exec_latter is executed for other, inferior matches 
# Only if symlink is set to 1 (see below)

set exec_latter = echo %file% %match%

#set exec_latter = ln -s %file% %match%


# exec_unmatched is executed for files that can not be matched.
# Only the %file% variable can be used
set exec_unmatched =  




# If strict = 0 => move file to best matching bookmark
# if strict = 1 => move file if there is at least and at most one match

set strict = 0

# If strict = 0, you can set symlink to 1, which will place symlinks to 
# the file in the best matching bookmarks in the other matching bookmarks.

set symlink = 1



# Directories:
#   0.  treat in the same way as files. Match on the available rules.
#   1.  look at its contents. Match files on the available rules.
#   2.  treat as file, only look at contents if no matches
set handle_directories = 2

# Structure:
#   0.  Flatten directory structure. Move files directly to match
#   1.  Retain directory structure. Move files to subdirectory in match
# Only applies if handle_directories >= 0

set retain_structure = 1



################################################################################
#   matches
#
#   format:
#          BOOKMARK matches expression EXPRESSION [WEIGHT]
#          BOOKMARK matches extensions EXTENSIONS [WEIGHT]
#          BOOKMARK matches itself [WEIGHT]
#          BOOKMARK matches regex REGEX [WEIGHT]
#          BOOKMARK matches sentence WORDS [WEIGHT]
#          BOOKMARK matches filesize OPERATOR FLOAT FILESUFFIX
#          BOOKMARK matches time OPERATOR FLOAT TIMESUFFIX
#         
#   where: 
#          
#          BOOKMARK:      Can be a bookmark from the bookmark index or a directory
#          WEIGHT:        (weight = FLOAT)
#          EXPRESSION:    A shell expression. Following UNIX design: 
#                         a return code of 0 means a match.
#          EXTENSIONS:    file extension separated by spaces 
#                         (starting dots and trailing commas will be ignored)
#          OPERATOR:      ==, <=, <, >, >=, !=
#          FILESUFFIX:    k, m, g, t, p
#          TIMESUFFIX:    years, months, weeks, days, hours, minutes, seconds
#
#  Rule qualifiers (expression, extensions, itself, etc.) don't have to be typed 
#  out exactly. Like bookmarks they are matched on prefix.
#
################################################################################

