Simple tool for automatic file management
1PTSD.JSON(5) "git.sr.ht/~hauleth/ptsd" "File Formats Manual" 2 3# NAME 4 5ptsd.json - actions specification for _ptsd_(1) 6 7# SYNTAX 8 9The file should use JSON format with array as a top-level value. Entries of 10these values should be objects containing at least these fields: 11 12*location* 13 Directory which will be read for files. 14 15*filter* 16 Object that defines filter that will select files on which actions will 17 be performed. See _FILTERS_. 18 19*actions* 20 Array of actions to be performed on files. Actions will be performed 21 from top to bottom. *Moves are not followed*. See _ACTIONS_. 22 23# FILTERS 24 25Filters are in form: 26 27 {"type": "<filter_name>", <opts>} 28 29Available filters are 30 31*name* 32 Match name of the file against pattern. Available options (exclusive): 33 34 - *exact* - match name exactly 35 - *wildcard* - match name against wildcard pattern 36 - *regex* - match name against regular expression 37 38*file_type* 39 Match OS type of the file. 40 41 Options: 42 43 - *is* - string that can be one of *dir*, *file*, *symlink* and will 44 return if subject of the test point to file of that type 45 46*content_type* 47 Match against content type. 48 49 Options: 50 51 - *mime* - will try to deduce MIME type of the file and will look for 52 exact match 53 - *magic* - object with field *bytes* that is array of integers within 54 range 0..255 that describe magic bytes that will be read from the file 55 and matched. Optionally there can be also used option *offset* that 56 describes offset from the beginning of the file for the pattern. 57 58*size* 59 Match against file size. 60 61 Options: 62 63 - *size* - value which will be compared with the file size 64 - *ordering* - one of *grater*, *equal*, *less* which determines what 65 comparison operator will be used. 66 67 68There are also meta filters: 69 70*not* 71 Takes one option *filter* and returns success if filter failed and vice 72 versa. 73 74*all* 75 Takes one option *filters* which is a list of filters and will succeed 76 if and only if all filters in list are successful match. 77 78*any* 79 Takes one option *filters* which is a list of filters and will succeed 80 if any of filters in list is successful match. 81 82# ACTIONS 83 84Current set of actions that are supported: 85 86*{"script": "<path>"}* 87 Execute script located at _<path>_ with file name in the question passed 88 as first argument. 89 90*{"move": "<dest>"}* 91 Move file to directory pointed by the _<dest>_. 92 93*{"echo": "<msg>"}* 94 Show _<msg>_ next to the filename. 95 96*"trash"* 97 Move file to trash in platform dependant way. 98 99# AUTHORS 100 101Created and maintained by: Łukasz Niemier <#@hauleth.dev>++ 102Sources available at: <https://git.sr.ht/~hauleth/ubin>++ 103Patches and bug reports: <~hauleth/public-inbox@lists.sr.ht> 104 105; vim: noexpandtab