# Declutter your Downloads folder with Python 😎

## Introduction

We download tons of files daily from the internet.

If you are a Windows user, they most probably land up in your Desktop folder by default, making it look like a mess.

For Unix users, it's generally the `~/Downloads` folder.

Having all the files in one folder makes it hard to navigate. It takes more time to reach the desired file. And **it simply looks bad**.

One great way of organizing files is by their mime type. That is, all the images go to one folder, all the pdfs to another, and so on.

So I made a simple tool, that can declutter your downloads folder.

## dirganize

- [PyPI](https://pypi.org/project/dirganize/)


## How to install?

Make sure you have [python](https://www.python.org/) and [pip](https://pip.pypa.io/en/stable/installing/) installed in your system.

The package `dirganize` is published to the Python Package Index. So, why wait, you can easily install it with a single `pip` command.

```shell
❯ pip install dirganize
```

## How to use ?

Navigate into the directory, which you want to organize, and run the `dirganize` command.

```shell
❯ cd Downloads
❯ dirganize
Creating mapping  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00
Moving files  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00

```

And that's it. Your folder is organized. 

Run the `ls` command (or `dir` for Windows) before and after executing `dirganize` to see the magic.

![alt text](https://cdn.hashnode.com/res/hashnode/image/upload/v1622707498234/sipM7oLJE.png)
 
## Your rules

Your folder. Your rules.

Want to change the rules? I mean the rules that govern which file goes to which folder. 

Then simply, put a `.dirganize.yml` file inside the folder to override the default configuration.


A yaml file is basically converted to a python dictionary by `dirganize`. The default dictionary is overwritten by the user-defined configuration (when available).



I am [Aahnik Daw](https://aahnik.dev) and you can follow me on [GitHub](https://github.com/aahnik) and [dev.to](https://dev.to/aahnik) to stay updated with my latest repos and articles.
