A Quick Simple Implementation of Python Automation

5 years ago when I didn’t know programming, I was fed up doing boring stuff on my PC. Among them, organizing the download folder manually is on top. But later when I learned programming (especially python programming), I put this boring stuff on autopilot mode.

In this post, you are going to see a very simple python script that can make your download folder arranged.

Let’s go!


Above code loops through all the files of the download folder and moves them.


move function checks the file type and sends the file to its corresponding folder (If the folder is not present, it will be created).


This file contains the functions that are responsible for checking the file type. If all goes fine, run main.py

Don’t forget to change the paths according to your folder paths.

python3 main.py

Boom!! Your download folder is not cluttered anymore!!

See! So simple! Right!

Now play with these codes to make your own version of automation.

NOTE: I only focused on automation, not on clean code. So make sure to write clean code ☺.

Wait, one minute! How does this become an automation system when you need to run the code manually?

This part can be solved using crontab (my os — Ubuntu 18.04). At first install crontab.

sudo apt-get install cron

Now edit the cron file with nano editor,

crontab -e

Add this ( *change path )

*/30 * * * *  /usr/bin/python3 /home/arif/python-projects/python-easy-code/others/organaize_download_folder/main.py >> /home/arif/cronjob.log 2>&1

I let the cron run my main.py every 30 minutes interval. The full details cron log is saved to my home folder.

Don’t forget to press 👏 so that others can reach it.

Software Engineer | Professional Scrum Master | Research Enthusiast

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store