---
title: "James Maskell (@wakingupat12) | Hashnode"
description: "James Maskell (@wakingupat12) writes on Hashnode. Read their latest articles and follow their work."
url: "https://hashnode.com/@wakingupat12"
---

@wakingupat12

# James Maskell

@wakingupat12 · Joined August 2021

## Comments

[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 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? 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? 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? 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!](https://hashnode.com/posts/automate-boring-files-organizing-using-python-python-files-organizer/612d61a12858872661b9ed60/comment/6135acc292d0321a99995977)

Comment · Article · Sep 6, 2021 · [Automate boring files organizing using python (Python files organizer)](https://hashnode.com/posts/automate-boring-files-organizing-using-python-python-files-organizer/612d61a12858872661b9ed60)
