Simple Python File Manager
This repository contains a Python script that lets you relocate files automatically.
How to use ?
Clone the repository:
Enter your desired folder and execute this command:
git clone https://github.com/aime-risson/pyFileManager.git
Install requirements:
Enter your pyFileManger folder and execute this command:
pip3 install watchdog
Set up the manager:
In the same directory create a new fille called manager.py
After that we will need to import our fileManager handler: MyHandler
from fileManager import MyHandler
handler = MyHandler()
Once imported we will need to create new events.
Events are used to listen to a specific folder and to relocate new files to a folder if their extensions match the desired ones.
For example:
listeningFolder = "Path/to/watched/folder"
relocateFolder = "Path/to/desired/folder"
extensionsToInclude = (".yourExtensionInLowerCase", ".jpg", ".png") #Tuple of strings !!!
handler.newEvent(listeningFolder, relocateFolder, extensionsToInclude)
You can use multiple events at the same time to "listen" to other folders, extensions ect...
Launch manager:
To launch manager juste add this to your code:
handler.start()
Full code:
from fileManager import MyHandler
handler = MyHandler()
listeningFolder = "Path/to/watched/folder"
relocateFolder = "Path/to/desired/folder"
extensionsToInclude = (".yourExtensionInLowerCase", ".jpg", ".png") #Tuple of strings !!!
handler.newEvent(listeningFolder, relocateFolder, extensionsToInclude)
handler.start()