This is a Python script that helps you organize your files in the Desktop and Downloads folder automatically. You can customize the organization rules by editing the config.json file.
- Organize files in the Desktop folder based on their file types into designated subfolders.
- Optionally organize files within subdirectories in the Desktop folder.
- Organize files in the Downloads folder based on their file types into designated subfolders.
- Ignore specified folders from being organized in both the Desktop and Downloads folder.
Before running the script, you can configure the organization rules by editing the config.json file. The config.json file contains two main sections:
-
target_directories: This section defines the target directories for each file type. When organizing files, the script will check the file's extension and move it to the corresponding folder. If the file type is not listed, it will be moved to the "Other" folder. -
custom_rules: This section allows you to specify custom rules for organizing specific files based on keywords in their names. You can define custom categories and subcategories for better organization. -
ignore_folders: This section allows you to specify a list of folders that you want to ignore when organizing files. Files within these folders will not be moved or organized.
Example config.json:
{
"target_directories": {
".jpeg": "Images",
".jpg": "Images",
".png": "Images",
".gif": "GIFs",
".pdf": "PDFs",
".docx": "Documents",
".pages": "Documents",
".xlsx": "Documents",
".mp4": "Videos",
".mov": "Videos",
".zip": "Archives"
},
"custom_rules": {
"resume": ["Documents", "Resumes"],
"screenshot": ["Images", "Screenshots"]
},
"ignore_folders": ["web_dev"]
}-
Make sure you have Python installed on your system.
-
Clone this repository to your local machine using the following command:
git clone https://github.com/bensonbjacob/File-Organizer.git -
Place the
file_organizer.pyandconfig.jsonfiles in the same directory where you want to run the organization process. -
Open a terminal (or command prompt) and navigate to the directory containing the
file_organizer.pyandconfig.jsonfiles. -
To organize files on the Desktop, run the following command:
python file_organizer.py --desktop --sub- The
--subargument is optional. If provided, the script will also organize files within subdirectories on the Desktop. Omit this argument if you don't want to organize subdirectories.
- The
-
To organize files in the Downloads folder, run the following command:
python file_organizer.py --downloads --sub- The
--subargument is optional. If provided, the script will also organize files within subdirectories on the Desktop. Omit this argument if you don't want to organize subdirectories.
- The
-
The script will automatically organize the files based on the rules defined in the
config.jsonfile. It will create the necessary folders and move the files accordingly. -
After running the script, check the Desktop and Downloads folders to see the organized files.
-
If you want to change the organization rules, edit the
config.jsonfile accordingly and rerun the script. -
To ignore specific folders from being organized, add the folder names to the
ignore_folderslist in theconfig.jsonfile.
-
The script will move files from your desktop to appropriate directories based on the configuration provided in config.json. Make sure to review the configuration carefully to ensure it matches your requirements.
-
The
--suboption is optional and can be used to enable organizing files within subdirectories. If not specified, the script will only organize files in the top-level directory. -
Adding the
--backupargument will automatically create a backup of the files before moving them. -
It is recommended to create a backup of your files before running the script, especially if you are using the
--suboption, to avoid unintended consequences. -
Please be cautious with the custom rules you define in the config.json file, as incorrect rules may cause files to be moved to unexpected locations.
-
This script assumes you are using it on a Mac or Linux system. If you are using Windows, some modifications may be required in the script.
This project is licensed under the MIT License - see the LICENSE file for details.