fsl / doc / index.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
<html lang="en">

    <title>File Selection Language</title>
    <link rel="stylesheet" href="fsl.css" type="text/css">
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <meta name="author" content="Kristian Ovaska">


<h1>File Selection Language</h1>

WWW: <a href=""></a> <br>
Author: <a href="">Kristian Ovaska</a>
        (kristian.ovaska [at] <br>
License: BSD<br>
Version: 0.5.1 (2005-12-05)<br>
Requirements: Python 2.3 or greater<br>
Platforms: Unix, Windows

File Selection Language (FSL) is a descriptive language for
file selection. It is used to selectively pick files from
a directory structure. FSL is useful for selective backups,
for instance.
FSL uses glob patterns as the basic building block. For
fine-tuning the selection, inclusion/exclusion rule combinations and
conditional expressions are available. File size and modification
date can be used in expressions.

Report bugs, send suggestions and give feedback to the author.

See documentation:
<li><a href="language.html">File Selection Language Reference</a>
<li><a href="fsltool.html">fsltool</a> usage (command-line tool)
<li><a href="changelog.html">Change log</a>
<li><a href="bugs.txt">Bug database</a>

<!-- UNCOMMENT for WWW index
<h2 id="download">Download</h2>

  <td>FSL 0.5
  <td><a href=""></a>
  <td>72 KB
  <td><b>FSL 0.5.1</b>
  <td><a href=""></a>
  <td>72 KB


<pre class="code">
IN home
    *.gif, *.jpg, *.png
    IN alfred
        EACH f IN *.ps, *.eps IF age(f) < 365
        *.pdf NONREC   # non-recursive

NOT usr/local/*.sh

NOT EACH f IN a* IF size(f) &gt 1000000 OR extract(date(f), "year") = 2001

This example program:
<li>Includes all <tt>*.gif</tt>, <tt>*.jpg</tt>, <tt>*.png</tt> files
    under <tt>/home</tt> (and its subdirectories)
<li>Includes <tt>*.ps</tt>, <tt>*.eps</tt> files under
    <tt>/home/alfred</tt> (and its subdirectories) that have been
    modified in the past year
<li>Includes <tt>*.pdf</tt> files located in <tt>/home/alfred</tt>, but
    not in any subdirectories of <tt>/home/alfred</tt>
<li>Includes all files under <tt>/usr</tt> ...
<li>... except <tt>*.sh</tt> files under <tt>/usr/local</tt>
    (in any subdirectory)
<li>Excludes all files beginning with <tt>a</tt> with size
    greater than 1,000,000 bytes or modification date in the year 2001.
    This rule applies to all files that were matched above.


FSL can be used with a command line tool (<a href="fsltool.html">fsltool</a>)
or, for Python programmers, with a programmable interface. For the Python
interface, see the documentation of <tt></tt>.

Several FSL rule files can be combined in a cascading manner similar to CSS.
The effect is the same as if the rule files were pasted into
a single file.

Support for both Windows-like and Unix-like paths.

Strict parse-time type checking to catch as many errors as possible
before run-time. For example, you can't say
<code>EACH f IF size(5) &gt 1000</code> because function
<code>size</code> expects filename argument.


<li>Download FSL
<li>Unpack the archive
<li>Install FSL:
        <li>If you have Python 2.4 or greater, and you want to install
            automatically, run <code>python install</code>.
            This installs FSL into your <tt>site-packages</tt> directory.
            You must have write permissions under <tt>site-packages</tt>.
        <li>If you have Python 2.3, you must install manually.
            If you plan to use FSL from the command line interface only,
            copy the FSL file tree into any directory of your choosing.
            If you plan to use FSL as a Python module as well,
            copy the fsl/ directory somewhere on your Python search
            path. To make sure you installed FSL correctly on the search
            path, execute <code>import fsl.fsltool</code> in a Python
<li>Test that the installation works by executing <code></code>
    under <tt>fsl/test/</tt>. The tests take some time to finish.
    Expected result: <em>one</em> test fails
    (<code>test_lexer.TestLexer.test_invalid</code>), all others pass.
    If you get this result, you can assume the program is installed correctly.
    If more tests fail, try to see if there is something obviously
    wrong with the installation or environment; if not, contact the author.
<li>Next, you can start playing with fsltool (<tt>fsl/</tt>)

Updated 2005-12-04