Worker file manager

1. File type system

1.1. File type definition

Worker uses a file type hierarchy to describe the file types. This means that it is possible to group similar file types together. For example different image formats can be grouped into one "Image" type so the program to display the images only needs to be defined once.

The file type itself can be described in four different ways which are described in the following.

1.1.1. Match file name by pattern

The easiest way is to enter a pattern for the file name (for example "*.png"). You can choose to ignore the file name case and to match the complete file name (in contrast to just the base name). The pattern can contain the wildcard "*" to match any string. You can also select to match the name with regular expression. If regular expressions are not used, you select an option to use multiple patterns, separated by commas.

1.1.2. Match by content

A better way to describe a file type is to use part of the file content. Even files without an extension or a different (potentially wrong) extension can be recognized correctly. However, this needs knowledge about some common bytes of the file type. You can enter these bytes directly or use a list of files and let Worker try to find common bytes. This method is very fast in comparison to the next method.

1.1.3. Match with libmagic

You can also utilize the "file" database from libmagic to detect the file type. In the configuration section you can select a file to see the output of libmagic. The actual pattern can contain the wildcard "*" to match any string.

Available options are:

1.1.4. Advanced matching

The advanced method allows the use of definitions of an expression. You can use boolean operations to combine several sub-expressions which includes tests for file content, tests for file name patterns or even tests for the output of external programs.

1.2. File type recognition

The file type recognition takes the file type hierarchy into account. Worker starts checking the type of a file at the root of the hierarchy. If the file matches any defined tests of a file type description, Worker checks the child types so the best match in the file type hierarchy is used.

Example: A root file type "executable script" could check if the file starts with "#! /" while any child type checks for additional information like "/bin/sh" for a shell script. This way files without "#!" at the beginning will not be checked for any child type.