From 2546345b12b1d8ebc3dc7d2fc631e67a84c5bd92 Mon Sep 17 00:00:00 2001 From: Thomas Feldmann Date: Fri, 5 Jan 2024 15:17:32 +0100 Subject: [PATCH] update docs --- docs/locations.md | 27 +++++---------------------- organize/location.py | 1 + organize/rule.py | 2 +- 3 files changed, 7 insertions(+), 23 deletions(-) diff --git a/docs/locations.md b/docs/locations.md index 3a580878..52c1b7df 100644 --- a/docs/locations.md +++ b/docs/locations.md @@ -39,6 +39,7 @@ rules: rules: - locations: - path: ... + min_depth: ... max_depth: ... search: ... exclude_files: ... @@ -53,6 +54,10 @@ rules: **path** (`str`)
Path to a local folder +**min_depth** (`int` or `null`)
+Minimum directory depth to search. This can be useful if you want to only handle files +in subdirectories of `location`. + **max_depth** (`int` or `null`)
Maximum directory depth to search. @@ -86,28 +91,6 @@ All other files are skipped. A list of patterns to match directory names that are included in this location. All other directories are skipped. -**filesystem** (str)
-A [Filesystem URL](#filesystems). - -### `filesystem` and `path` - -If you want the location to be the root (`"/"`) of a filesystem, use `path`: - -```yml -rules: - - locations: - - path: zip:///Users/theuser/Downloads/Test.zip -``` - -If you want the location to be a subfolder inside a filesystem, use `path` and `filesystem`: - -```yml -rules: - - locations: - - filesystem: zip:///Users/theuser/Downloads/Test.zip - path: "/folder/in/the/zipfile/" -``` - ### `max_depth` and `subfolders` - If `subfolders: true` is specified on the rule, all locations are set to `max_depth: null` diff --git a/organize/location.py b/organize/location.py index 6ddfde4b..56fe4e25 100644 --- a/organize/location.py +++ b/organize/location.py @@ -23,6 +23,7 @@ @dataclass(config=ConfigDict(extra="forbid")) class Location(BaseModel): path: FlatList[str] + min_depth: int = 0 max_depth: Union[Literal["inherit"], int, None] = "inherit" search: Literal["depth", "breadth"] = "breadth" exclude_files: Set[str] = Field(default_factory=set) diff --git a/organize/rule.py b/organize/rule.py index 10bcca64..12f769e0 100644 --- a/organize/rule.py +++ b/organize/rule.py @@ -219,7 +219,7 @@ def walk(self, rule_nr: int = 0): max_depth = location.max_depth walker = Walker( - min_depth=0, + min_depth=location.min_depth, max_depth=max_depth, filter_dirs=location.filter_dirs, filter_files=location.filter,