---
title: "Discussion on \"Automate boring files organizing using python (Python files organizer)\" | Hashnode"
description: "Discussion on \"Automate boring files organizing using python (Python files organizer)\". Intro\nHello today we are going to code a files organizer using python script it will organize the files by their types for example it will put all files with extension (.png) in a folder called Pictures let's code ... (this post is published here Pyt..."
url: "https://hashnode.com/posts/automate-boring-files-organizing-using-python-python-files-organizer/612d61a12858872661b9ed60"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Automate boring files organizing using python (Python files organizer)](https://icodes.hashnode.dev/automate-boring-files-organizing-using-python-python-files-organizer?utm_source=hashnode&utm_medium=feed)

Intro Hello today we are going to code a files organizer using python script it will organize the files by their types for example it will put all files with extension (.png) in a folder called Pictures let's code ... (this post is published here Pyt...

Aug 30, 2021 · 3 min read · icodes.hashnode.dev  
Updated Sep 13, 2021  
Read the article

-   [#python](https://hashnode.com/tag/python)
-   [#python-projects](https://hashnode.com/tag/python-projects)
-   [#programming-blogs](https://hashnode.com/tag/programming-blogs)

## Written by

[Budy mnvenom](https://hashnode.com/@xbudy)

@xbudy

  
[View profile](https://hashnode.com/@xbudy)

## Responses 1

Markdown supported · ⌘↵ to post

[James Maskell](https://hashnode.com/@wakingupat12)

[Sep 6, 2021](https://hashnode.com/posts/automate-boring-files-organizing-using-python-python-files-organizer/612d61a12858872661b9ed60/comment/6135acc292d0321a99995977)

Hi! Good work.

I have some feedback which might help you refactor this code to make it more flexible and less open to bugs appearing

1.  There is a lot of repeated/duplicate code in your if statement. Have you thought about creating a method which performs the move file code?
2.  The code above relies on the directories in file\_folders dictionary existing. Have you thought about what would happen if those directories hadn't been created prior to the program running?
3.  The code above has the file\_folder 'types' (documents, pictures, etc) hard coded in your if statement. Have you thought about creating a method that gets the key from the file extension?
4.  Do you need both the file\_folder and file\_type dictionaries, or can you turn them into a single dictionary?

I personally would turn this into a Python class too, so that I can inject the file types, file folders and the path I'm moving files from into the class.

Happy coding!

[Budy mnvenom](https://hashnode.com/@xbudy)

[Sep 13, 2021](https://hashnode.com/posts/automate-boring-files-organizing-using-python-python-files-organizer/612d61a12858872661b9ed60/comment/6135acc292d0321a99995977#reply-613f74e1058ab733a84c40dd)

thank you so much for your feedback. i agree with you about turning this into a python class it will make the code more clean and remove the repeated/duplicate code. and specially the methods. thank you again for your comment
