-
Notifications
You must be signed in to change notification settings - Fork 0
JSON Configuration Options
This page explains how to write a JSON config file to set the sorting algorithm.
In the Sortery directory, there is a file named template.json. This JSON file is an example of the structure required for a JSON config file. This is what template.json looks like:
{
"date_format": "%Y-%m-%d %Hh%Mm%Ss",
"date_type": "m",
"exclude_type": ["png"],
"only_type": ["json", "py"],
"preserve_name": false
}Note that although the command-line arguments use hyphens - to separate words, due to the structure of the JSON parser, all JSON config options must use underscores _ instead. Below are explanations of each item in the JSON file, and how to use them.
This corresponds with the date-format command-line option. This value takes any value that date-format takes, and must be a string.
This corresponds with the date-type command-line option. This value takes any value that date-type takes, and must be a string. The three date_type options are explained as follows:
| Option | How it sorts |
|---|---|
| a | Sort all the files by access time: the last time each file was accessed. |
| c | Sort all the files by creation time: the time each file was created. |
| m | Sort all the files by modification time: the time each file was last modified. |
This corresponds with the exclude-type command-line option. This value is a list of any file extensions (jpg, odt, etc.) to be excluded from the sorting. Each item in the list must be a string, and must be separated from other items by a comma, as per proper JSON formatting.
This corresponds with the only-type command-line option. This value is a list of any file extensions (jpg, odt, etc.) to be exclusively sorted. Each item in the list must be a string, and must be separated from other items by a comma, as per proper JSON formatting. Note that this item overrides the exclude_type item.
This corresponds with the preserve-name flag. This value sets whether to preserve the original file name after the date when sorting, and is a bool. It must be one of either true or false (JSON is case-sensitive).