Skip to content

File Organizer is a Python tool that automatically sorts files from specified directories by date and file type. Configurable and easy to run in the background, it keeps your folders organized without manual effort.

License

Notifications You must be signed in to change notification settings

Daniel-Kudies/FileOrganizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

License Pylint

FileOrganizer

FileOrganizer is a Python-based utility for organizing files within specified directories, allowing users to sort files by date and by file extension. It runs in the background and is configurable through JSON files.

Features

  • Sort by Date: Organizes files into folders by year based on creation date.
  • Sort by Extension: Organizes files into folders based on file extension categories.
  • Background Operation: Runs without a user interface and performs tasks quietly.
  • JSON Configuration: Customizable configuration for directories and file extensions.

Project Structure

FileOrganizer/
├── .github
│   ├── configs
│   │   └── .pylintrc            # Contains the settings for the linting
│   ├── workflows
│   │   └── pylint.yml           # Contains the workflow logic for the linting
├── config
│   ├── config.json              # Main configuration file
│   └── file_extensions.json     # Defines extensions for different file types
├── file_organizer
│   ├── file_sorter.py           # Contains the main sorting logic
│   ├── json_loader.py           # Loads configurations from JSON files
│   └── main.py                  # Entry point to run the file organizer
├──tests
│   └── test_json_loader.py      # Tests for the json_loader.py
├── requirements.txt

In config/config.json, specify the directories and sorting options:

"directories": {
  "Downloads": {
    "path": "~/Downloads",
      "sorting": {
        "by_date": true,
        "by_extension": true
      }
  }
}

In config/file_extensions.json, define file types and extensions:

{
    "Audio": [
        ".aif",
        ".cda"
    ],
    "Text": [
        ".txt",
        ".doc"
    ]
}

Logging:

Logs provide insights into the sorting process, stored in logfile.log. Logging levels (INFO, DEBUG, ERROR) are adjustable in main.py.

Code Overview

  • file_sorter.py: Core logic for organizing files by date and extension. It manages folder creation based on year and file category.
  • json_loader.py: Manages loading and retrieving JSON configuration data.
  • main.py: Initializes the sorting process and sets logging configurations.

Requirements

Python 3.x

License

This project is open-source. Feel free to modify and adapt it to your needs.

About

File Organizer is a Python tool that automatically sorts files from specified directories by date and file type. Configurable and easy to run in the background, it keeps your folders organized without manual effort.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages