This content originally appeared on DEV Community and was authored by Aahnik Daw
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.
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.
See the syntax and default configuration here.
A yaml file is basically converted to a python dictionary by dirganize
. The default dictionary is overwritten by the user-defined configuration (when available).
py-utility-pack
Dirganize is a part of py-utility-pack
.
You can get more such tools here ?
aahnik / py-utility-pack
Collection of small Python packages and simple CLI tools that will make you dry. Install via pip and start using without delay.
py-utility-pack
Collection of small Python packages and simple CLI tools that will make you dry.
Install via pip and start using without delay.
Here is a list of packages in this repo.
Package | Description |
---|---|
verlat | Get to know the latest version of a python package on PyPI. |
ado-py | Do stuff with python. Quickly access functions from the command-line. |
minsert | Insert dynamic content in markdown, without using a separate template file. |
mendi | Simple wrapper that helps you write a menu-driven program easily. |
dirganize | A command-line tool to organize files into category directories. |
Feel free to contribute a new one. See Contributing Guidelines for more details.
I am Aahnik Daw and you can follow me on GitHub and dev.to to stay updated with my latest repos and articles.
This content originally appeared on DEV Community and was authored by Aahnik Daw
Aahnik Daw | Sciencx (2021-04-08T13:27:41+00:00) Declutter your Downloads folder with Python ?. Retrieved from https://www.scien.cx/2021/04/08/declutter-your-downloads-folder-with-python-%f0%9f%98%8e/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.