unclutter-directory


Nameunclutter-directory JSON
Version 0.9.3 PyPI version JSON
download
home_pageNone
SummaryUnclutter your directory with ease.
upload_time2025-01-28 22:36:15
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT
keywords unclutter directory organize clean files folders
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![Tests](https://github.com/zirition/unclutter-directory/workflows/Python%20package/badge.svg)](https://github.com/zirition/unclutter-directory/actions?query=workflow%3APython%20package)

# Unclutter Directory

Unclutter Directory is a Python-based tool for organizing files in a directory according to specified rules. It allows you to move, delete, or compress files based on file conditions such as name patterns, size, and age.

It also can search within `zip` and `rar` archive for files that matches the rules.

The rules are defined in a simple YAML file used as a parameter.

## Features
- **Move**: Move files to a specified directory.
- **Delete**: Permanently remove files.
- **Compress**: Compress files into a `.zip` archive.

Using 
- **Customizable Rules**: Define conditions like name patterns, file size, and age for performing actions.
- **Dry Run Mode**: Simulate actions without making actual changes to verify intended effect.
- **Support for Hidden Files**: Option to include hidden files (files starting with a dot).
- **Flexible Deletion Options**: Choose to always delete matched files or never delete them.

## Requirements

- Python 3.13 or higher
- [Click](https://pypi.org/project/click/) 
- [PyYAML](https://pypi.org/project/PyYAML/) 
- [rarfile](https://pypi.org/project/rarfile/)

## Installation

Install using `pip`:
   ```bash
   pip install unclutter-directory
   ```

## Usage

### Command-Line Interface

#### Organize

Organize files in a directory based on your rules:

```bash
python -m unclutter-directory organize <target_dir> [<rules_file>] [--dry-run] [--quiet] [--always-delete] [--never-delete] [--include-hidden]
```

- `<target_dir>`: Directory path where the files are to be organized.
- `<rules_file>`: Path to the YAML file containing organization rules. If omitted, it searches for `.unclutter_rules.yaml` in `<target_dir>`.
- `--dry-run`: Optional flag for simulating the actions without making changes.
- `--quiet`: Optional flag to suppress non-error messages.
- `--always-delete`: Optional flag to always delete matched files without confirmation.
- `--never-delete`: Optional flag to never delete matched files.
- `--include-hidden`: Optional flag to include hidden files (files starting with a dot).

### Validate

Validate the structure and attributes of a rules file:

```bash
python -m unclutter-directory validate <rules_file>
```

- `<rules_file>`: Path to the YAML file that contains organization rules.

### Rules File

Define rules in a YAML file. Here is an example:

```yaml
- name: "Process STL Files"
  conditions:
    end: ".stl"
  action:
    type: "move"
    target: "stl_files/"
  check_archive: true

- name: "Process ISO Files"
  conditions:
    end: ".iso"
    older: "2d"
  action:
    type: "move"
    target: "iso_files/"
  check_archive: true
```

The file `example_rules.yaml` contains in the first rule all the options. 

The rules are processed in order, the first rule that is a match is the rule used, so put first the more specific ones.

## Testing

Run the unit tests to verify functionality:

```bash
python -m unittest discover tests
```

## Contributing

Contributions are welcome! 

## License

This project is licensed under the MIT License.

## Contact

You can reach me at `owner of the repo` AT `owner of the repo` DOT `com`

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "unclutter-directory",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "unclutter, directory, organize, clean, files, folders",
    "author": null,
    "author_email": "zirition <zirition@zirition.com>",
    "download_url": "https://files.pythonhosted.org/packages/23/68/384fa7a9c3503085fe0657d3b0636c265490ed47610d95a194d346f2160a/unclutter_directory-0.9.3.tar.gz",
    "platform": null,
    "description": "[![Tests](https://github.com/zirition/unclutter-directory/workflows/Python%20package/badge.svg)](https://github.com/zirition/unclutter-directory/actions?query=workflow%3APython%20package)\n\n# Unclutter Directory\n\nUnclutter Directory is a Python-based tool for organizing files in a directory according to specified rules. It allows you to move, delete, or compress files based on file conditions such as name patterns, size, and age.\n\nIt also can search within `zip` and `rar` archive for files that matches the rules.\n\nThe rules are defined in a simple YAML file used as a parameter.\n\n## Features\n- **Move**: Move files to a specified directory.\n- **Delete**: Permanently remove files.\n- **Compress**: Compress files into a `.zip` archive.\n\nUsing \n- **Customizable Rules**: Define conditions like name patterns, file size, and age for performing actions.\n- **Dry Run Mode**: Simulate actions without making actual changes to verify intended effect.\n- **Support for Hidden Files**: Option to include hidden files (files starting with a dot).\n- **Flexible Deletion Options**: Choose to always delete matched files or never delete them.\n\n## Requirements\n\n- Python 3.13 or higher\n- [Click](https://pypi.org/project/click/) \n- [PyYAML](https://pypi.org/project/PyYAML/) \n- [rarfile](https://pypi.org/project/rarfile/)\n\n## Installation\n\nInstall using `pip`:\n   ```bash\n   pip install unclutter-directory\n   ```\n\n## Usage\n\n### Command-Line Interface\n\n#### Organize\n\nOrganize files in a directory based on your rules:\n\n```bash\npython -m unclutter-directory organize <target_dir> [<rules_file>] [--dry-run] [--quiet] [--always-delete] [--never-delete] [--include-hidden]\n```\n\n- `<target_dir>`: Directory path where the files are to be organized.\n- `<rules_file>`: Path to the YAML file containing organization rules. If omitted, it searches for `.unclutter_rules.yaml` in `<target_dir>`.\n- `--dry-run`: Optional flag for simulating the actions without making changes.\n- `--quiet`: Optional flag to suppress non-error messages.\n- `--always-delete`: Optional flag to always delete matched files without confirmation.\n- `--never-delete`: Optional flag to never delete matched files.\n- `--include-hidden`: Optional flag to include hidden files (files starting with a dot).\n\n### Validate\n\nValidate the structure and attributes of a rules file:\n\n```bash\npython -m unclutter-directory validate <rules_file>\n```\n\n- `<rules_file>`: Path to the YAML file that contains organization rules.\n\n### Rules File\n\nDefine rules in a YAML file. Here is an example:\n\n```yaml\n- name: \"Process STL Files\"\n  conditions:\n    end: \".stl\"\n  action:\n    type: \"move\"\n    target: \"stl_files/\"\n  check_archive: true\n\n- name: \"Process ISO Files\"\n  conditions:\n    end: \".iso\"\n    older: \"2d\"\n  action:\n    type: \"move\"\n    target: \"iso_files/\"\n  check_archive: true\n```\n\nThe file `example_rules.yaml` contains in the first rule all the options. \n\nThe rules are processed in order, the first rule that is a match is the rule used, so put first the more specific ones.\n\n## Testing\n\nRun the unit tests to verify functionality:\n\n```bash\npython -m unittest discover tests\n```\n\n## Contributing\n\nContributions are welcome! \n\n## License\n\nThis project is licensed under the MIT License.\n\n## Contact\n\nYou can reach me at `owner of the repo` AT `owner of the repo` DOT `com`\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Unclutter your directory with ease.",
    "version": "0.9.3",
    "project_urls": {
        "Homepage": "https://github.com/zirition/unclutter-directory",
        "Issues": "https://github.com/zirition/unclutter-directory/issues"
    },
    "split_keywords": [
        "unclutter",
        " directory",
        " organize",
        " clean",
        " files",
        " folders"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "90889189d47af9943c7606d6bcc2bc39a94e1bc4266d6f410895d4c27a02f239",
                "md5": "240eaa50c20c2a484c177703841e0ee1",
                "sha256": "58844db9a810fdaca0d374a72c973c2dc8a0dedaf9138e517d651559720507c4"
            },
            "downloads": -1,
            "filename": "unclutter_directory-0.9.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "240eaa50c20c2a484c177703841e0ee1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 11178,
            "upload_time": "2025-01-28T22:36:12",
            "upload_time_iso_8601": "2025-01-28T22:36:12.906428Z",
            "url": "https://files.pythonhosted.org/packages/90/88/9189d47af9943c7606d6bcc2bc39a94e1bc4266d6f410895d4c27a02f239/unclutter_directory-0.9.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "2368384fa7a9c3503085fe0657d3b0636c265490ed47610d95a194d346f2160a",
                "md5": "0c8762e93d00075a3d71b06ef7b9af59",
                "sha256": "10adf03911498fe837f3a6d422fbe7eef8af98eed609838be48c8876f596efb2"
            },
            "downloads": -1,
            "filename": "unclutter_directory-0.9.3.tar.gz",
            "has_sig": false,
            "md5_digest": "0c8762e93d00075a3d71b06ef7b9af59",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 15342,
            "upload_time": "2025-01-28T22:36:15",
            "upload_time_iso_8601": "2025-01-28T22:36:15.271610Z",
            "url": "https://files.pythonhosted.org/packages/23/68/384fa7a9c3503085fe0657d3b0636c265490ed47610d95a194d346f2160a/unclutter_directory-0.9.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-28 22:36:15",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "zirition",
    "github_project": "unclutter-directory",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "unclutter-directory"
}
        
Elapsed time: 0.50737s