Declutter your Downloads folder with Python ๐Ÿ˜Ž

Declutter your Downloads folder with Python ๐Ÿ˜Ž

ยท

2 min read

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

How to install?

Make sure you have python and pip 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.

โฏ pip install dirganize

How to use ?

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

โฏ 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

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 and you can follow me on GitHub and dev.to to stay updated with my latest repos and articles.