Sitemap

File Grouping Python Script

--

Press enter or click to view image in full size
grouping similar files into a folder

This article is about how to use simple python script that groups files with same extension into a folder

This eradicates the tedious and boring job of creating folders manually and moving files into them.

Let’s dive in and see how it works …..!

Where to keep the script?

The script should be outside the folder which you need to organize

Get DasarajuAbhishekVarma’s stories in your inbox

Join Medium for free to get updates from this writer.

In my case experiment folder has script named demo.py and live_demo is the folder containing various files

Press enter or click to view image in full size
folder containing script and folder to organize
contents in experiment folder
Press enter or click to view image in full size
pic of folder containing files with various extensions
contents in live_demo folder

Now comes our magic script

demo.py file

Now just execute the above file and see the magic. You should see the files are arranged in their respective extension folders like below.

organized files folders

If you like the post please show you interest in comments. Next time I will come up with something exciting.

--

--

DasarajuAbhishekVarma
DasarajuAbhishekVarma

Written by DasarajuAbhishekVarma

Data Science Enthusiast, love to work in cutting edge technologies and a python lover