How to organize files in Linux by classifying them into different directories

As a technical writer, my job involves playing with a lot of files - sometimes, I am cropping images, other times I am playing with .zip and .deb files. Not to mention PDFs and other document types that we all deal with in our day to day computer work.

At present my Downloads directory contains over a thousand items, including directories, files, and images. So, I was looking for a tool that could organize at-least files by classifying them into different directories. And I found one - Classifier.

In this article, we will discuss how the tool can be installed and how you can use it. But before we do that, it's worth mentioning that all the commands and instructions mentioned in this article have been tested on Ubuntu 14.04LTS.

How to install and use Classifier

According to official documentation, Classifier organizes "files in your current directory, by classifying them into folders of music, pdfs, images, etc."

Here's how you can install the tool:

pip install classifier

In case 'pip' isn't installed, you can install it using the following command:

sudo apt-get install python-pip

Once Classifier is installed, you can use it by running the following command:


The aforementioned command should be either run inside the directory whose contents you want to organize, or by passing the complete path to that directory as value to the -d command line option.

For example, here's the directory whose contents I wanted to organize:


So, I executed the following command:


See, how Classifier created new directories and moved some of the files there.


So far so good. But there are still files that haven't been moved. Well, that's because Classifier works on file extensions and most of the files that were left out don't have any extension.

But what about the .c file you might ask? Well, all I could conclude was that the tool doesn't take any action for source files, but there are options (-st and -sf) that you can use to tell Classifier what kind of files should be moved in what kind of directories.

For example, I used the following command to move any .c, .cpp, and .py files to a directory named 'source-files.'


For more information, head to the tool's GitHub page.

Leave a Comment