Skip to content

πŸ“ A file watcher that moves files with specified extensions to a destination folder, with date-based subdirectories to prevent overwriting. Can watch multiple folders and handle file naming collisions. Uses watchdog library for event handling.

License

Notifications You must be signed in to change notification settings

TheHumanoidTyphoon/file-watcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

FileWatcher

FileWatcher is a Python script that monitors a folder for changes and moves files with specific extensions to a destination folder.

Preview

Prerequisites

  • Python 3.6 or higher
  • watchdog library (pip install watchdog)

Usage

  • Clone or download the repository.

  • Install the prerequisites.

  • Open a command prompt or terminal window.

  • Navigate to the folder containing the script.

  • Type the following command: python filewatch.py [watched_folder] [destination_folder] [--extensions]

  • Replace [watched_folder] with the path of the folder to be monitored and [destination_folder] with the path of the folder where the files will be moved.

--extensions is an optional parameter that accepts a list of file extensions to be moved. By default, the script moves .jpg, .png, .pdf, and .py files.

How it works

The script uses the watchdog library to monitor the specified folder for changes. When a file is modified, the script checks if it has a specified extension. If it does, the script moves the file to the destination folder. Also the script creates subdirectories within the destination folder based on the current year and month. If a file with the same name already exists in the destination folder, the script renames the file with a numerical suffix to avoid overwriting the existing file.

Contributing

Contributions are welcome! If you have any ideas for enhancing the program or identifying bugs, kindly submit an issue or pull request on the GitHub repository.

Customizing the script

You can customize the script by modifying the following variables:

  • watched_folder: The folder to be monitored for changes.
  • destination_folder: The folder where the files will be moved.
  • extensions: A dictionary containing the file extensions and their corresponding subdirectory names.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

πŸ“ A file watcher that moves files with specified extensions to a destination folder, with date-based subdirectories to prevent overwriting. Can watch multiple folders and handle file naming collisions. Uses watchdog library for event handling.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages