Skip to main content

A simple directory configuration tool

Project description

dirconfig 📂

PyPI PyPI - Python Version PyPI - License GitHub Actions Workflow Status

Configure what files should be in what folders using an easy-to-read YAML config file.

Features

  • File Organization: Automatically move files based on their extension from one directory to another.
  • Automated Backups: Set up scheduled backups for important directories using urbackup.
  • Notification System: Get notified regarding specific events specified in the configuration file.

Installation

Install dirconfig using pip:

pip install dirconfig

Configuration

Create a config.yml file in your working directory with your automation tasks. Here's an example configuration that organizes .jpg and .pdf files into separate directories:

tasks:
  - name: Organize Downloads
    type: file-organization
    source: /path/to/your/source/directory
    rules:
      - extension: .jpg
        destination: /path/to/your/destination/for/images
      - extension: .pdf
        destination: /path/to/your/destination/for/documents
backup:
  - name: Backup Important Files
    type: incremental-file # incremental-image, full-file, full-image
    schedule: daily # weekly, monthly
    retention: 7 # number of days to keep backups
    connection:
      server: http://your-backup-server:55414
      username: foo
      password: bar
    directories:
      - /path/to/your/important/directory
      - /path/to/another/important/directory

Usage

dirconfig is designed to run as a daemon, monitoring specified directories and automatically organizing files according to the configurations defined in your config.yml file.

You can generate a sample config.yml file using the following command:

dirconfig generate

Starting dirconfig

To initiate dirconfig and begin the monitoring process, use the following command:

dirconfig start

This command starts dirconfig, which operates in the background. It will watch the source directories specified in your config.yml for any changes, organizing files according to your predefined rules.

Alternatively, to run dirconfig as a separate process, use the following command:

dirconfig start &

Stopping dirconfig

To stop the dirconfig daemon, execute:

dirconfig stop

This command stops the background process of dirconfig, halting the monitoring and file organization tasks.

Command Line Options

usage: dirconfig [-h] [--config CONFIG] [--log LOG] [--pid PID] {start,stop,generate}

dirconfig Daemon

positional arguments:
  {start,stop,generate}
                        Dirconfig actions to perform

options:
  -h, --help            show this help message and exit
  --config CONFIG       Path to the configuration file
  --log LOG             Path to the log file
  --pid PID             Path to the PID file

Advanced Management

For long-term operation or deployment, integrating dirconfig with system services or process managers can offer more graceful management, including automatic restarts, logging, and simplified start/stop operations.

Extending dirconfig

dirconfig welcomes enhancements and customization. If you're interested in adding new features or improving the tool, consider contributing to the source code. Your input and contributions are highly appreciated.

Urbackup Documentation

For more information on the Urbackup API, please refer to these resources:

*Important Note: For Windows the command-line tool is urbackupclient_cmd. Mac and Linux use urbackupclientctl.

Command Line Options for urbackupclientctl are as follows:

USAGE:

        urbackupclientctl [--help] [--version] <command> [<args>]

Get specific command help with urbackupclientctl <command> --help

        urbackupclientctl start
                Start an incremental/full image/file backup

        urbackupclientctl status
                Get current backup status

        urbackupclientctl browse
                Browse backups and files/folders in backups

        urbackupclientctl restore-start
                Restore files/folders from backup

        urbackupclientctl set-settings
                Set backup settings

        urbackupclientctl reset-keep
                Reset keeping files during incremental backups

        urbackupclientctl add-backupdir
                Add new directory to backup set

        urbackupclientctl list-backupdirs
                List directories that are being backed up

        urbackupclientctl remove-backupdir
                Remove directory from backup set

License

dirconfig is licensed under the MIT License. See the LICENSE file for more details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dirconfig-0.2.6.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

dirconfig-0.2.6-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file dirconfig-0.2.6.tar.gz.

File metadata

  • Download URL: dirconfig-0.2.6.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.19

File hashes

Hashes for dirconfig-0.2.6.tar.gz
Algorithm Hash digest
SHA256 ffd19802e2733cbad9bb5c148608a4555895d0b5e5d4a2180095cec84a8e76f4
MD5 95715325049f1aafa64232da31f2ac4e
BLAKE2b-256 97d2cc2e63e4a29781b80cdc88fe61a5285b8fd888f7726c63a092ce84ca943b

See more details on using hashes here.

File details

Details for the file dirconfig-0.2.6-py3-none-any.whl.

File metadata

  • Download URL: dirconfig-0.2.6-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.19

File hashes

Hashes for dirconfig-0.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 5eb2b4d932caa859a1637c3832bf1118aac6eaefb8165b821e0655c57fb312c6
MD5 d14b14fc942f02d5bf8306540a8c8ba9
BLAKE2b-256 763e6b8e523473f4308354268b0d32d16c2505f11e21441c3410e3c0a8c49a2a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page