You are browsing as a guest. Sign up (or log in) to start making projects!

Open comments for this post

1h 56m 37s logged

I had a bug for the past few days that did not let me log hours. Here’s what I did:

part 1 - I created code that scans folders using pathlib.path and printed each files name that got moved.

Part 2 - Takes a hardcoded source file and destination folder, creates the destination if it doesn’t exist using .mkdir(parents = True, exist_ok = True), and moves the file using shutil.move()

Part 3 - Loads rules from config.json using json.load() prints them and has an add_rule() function that function that appends a new rule dict and saves the updated list back using json.dump()

Part 4 - A live file watcher using watchdog. Creates a Sentinel Handler class that inherits from FileSystemEventHandler and overrides on_created to print the path of any new file. Uses an Observer to watch the Downloads folder in the background. Keeps the program alive using an while True loop and stops the program using KeyboardInterrupt

Part 5 - Extends Part 4 with a rules engine. When a file is created on_created loads rules from config.json, checks if file’s extensions matches any rules file_type, creates the destination folder if needed and moves the file automatically using shutil.move()

Part 6 - Still in progress. Extends Part 5 with an undo history.

0
1

Comments 0

No comments yet. Be the first!