contador web Saltar al contenido

Organize your files via terminal with Classifier

There are situations where the best and most practical option is to let the computer do all the dirty work. Don't get me wrong, but too repetitive tasks end up demotivating me. For example, it is common for you to fill your Downloads folder with numerous files, and to quickly find something a birthing (as TI Guy would say). I thought of writing a script to solve this problem, why not search and see if there is already a solution? After all, I don't want to waste time reinventing the wheel.

classifier-script-python-files

If just like me you need a solution that automatically organizes your files quickly and easily, Classifier can be a good solution. This very interesting Python script.

Classifier Operation

Understand the Classifier in the complicated swim. It will automatically organize your files by moving by type to directories pre-selected by the script. For example, .mp3 extension files will be moved to a folder (in the very directory you are organizing) called Music. .Png files for a Pictures call and successively. The following is the list of extensions and their categories, by default:

IGNORE IT:

part, desktop.

Music:

mp3, aac, flac, ogg, wma, m4a, aiff, wav, amr.

Videos:

flv, ogv, avi, mp4, mpg, mpeg, 3gp, mkv, ts, webm, vob, wmv.

Pictures:

png, jpeg, gif, jpg, bmp, svg, webp, psd, tiff.

Archives:

rar zip 7z gz bz2 tar dmg tgz xz iso cpio.

Documents:

txt, pdf, doc, docx, odf, xls, xlsv, xlsx, ppt, pptx, ppsx, odp, odt, ods, md, json, csv.

Books:

mobi epub chm.

DEBPackages:

deb.

Programs:

exe, msi.

RPMPackages:

rpm

You can add new extensions and modify folder names directly in the Classifier configuration file by simply modifying the hidden file. .classifier-master.conf contained in your home folder. Classifier itself allows this modification, use the command:

classifier –edittypes

Or the abbreviated version of the command:

classifier -et

Your system's default document editor opens, so you save time without having to go to your home folder and locate the configuration file. To reset changes use this:

classifier –reset

Or the other option:

classifier -rst

Hands in the dough

To organize your files, you can do it in a few ways. Navigating via terminal to the directory you want to organize and right after using the command classifier:

classifier-script-python-files-organization-linux-organize-ubuntu

However, if there are subdirectories, this is not the most appropriate way. I suggest creating a folder where you want to keep the files organized and through Classifier, specify this directory, for example:

classifier PASTA_COM_FILES PASTA_ORGANIZED, the syntax would look like this:

classifier -d PASTA_COM_ FILES -o PASTA_ORGANIZED

At where –d (–directory) the target directory, with the files and -O (–output) the output, where the files will be organized. You can use other parameters and see the full functionality of the script. –help:

classifier -h

Installing Classifier in Your Distribution

Before we install Classifier, you will need to install the Python package manager. Use the command according to your distribution.

Debian, Ubuntu, Deepin, Mint and derivatives:

sudo apt install python-pip

Fedora:

sudo dnf install python-pip

openSUSE

sudo zypper install python-pip

Arch Linux, Manjaro and derivatives:

sudo pacman -S python-pip

Then install Classifier:

sudo pip install classifier

Classifier can be very useful and practical for organizing that mess, being an indispensable utility for those who end up with time cluttering their files. maybe it is not the most powerful solution, however, wait for news to come ().

Until the next post, SYSTEMATICALLY!

_____________________________________________________________________________ See any errors or would you like to add any suggestions to this article? Collaborate, click here.