Organise My Mac is a Python script that helps you organise files and folders on your Mac by categorising them into predefined folders (e.g., Images, Documents, Videos). It's a simple and efficient way to keep your directories neat and tidy.
- Automatically categorises files and folders into predefined categories.
- Handles both files and subfolders in the target directory.
- Supports flexible directory input, including paths with
~
(home directory). - Prevents folders from being moved into themselves.
The script organises items into the following categories:
- Images:
.jpg
,.jpeg
,.png
,.gif
,.bmp
,.tiff
,.svg
- Documents:
.pdf
,.doc
,.docx
,.txt
,.xls
,.xlsx
,.ppt
,.pptx
- Audio:
.mp3
,.wav
,.aac
,.flac
,.ogg
- Videos:
.mp4
,.mov
,.avi
,.mkv
,.flv
,.wmv
- Archives:
.zip
,.rar
,.tar
,.gz
,.7z
- Code:
.py
,.js
,.html
,.css
,.java
,.c
,.cpp
,.php
,.rb
,.ts
,.jsx
,.tsx
,.astro
,.svelte
,.vue
,.json
,.yaml
,.yml
- Executables:
.exe
,.dmg
,.pkg
- Others: Any files not matching the above categories.
-
Download or clone the repository:
git clone https://github.com/yourusername/organise-my-mac.git
-
Navigate to the project folder:
cd organise-my-mac
-
Ensure Python is installed:
python3 --version
If Python is not installed, download it from python.org.
-
Open a terminal and navigate to the
organise-my-mac
folder:cd /path/to/organise-my-mac
-
Run the script:
python3 main.py
-
Enter the path of the folder you want to organise when prompted:
- Absolute path:
/Users/jschof1/Downloads
- Relative path:
./Downloads
- Home directory shortcut:
~/Downloads
- Absolute path:
-
The script will organise files and folders into subdirectories within the specified folder.
Before Running
Downloads/
file1.jpg
file2.pdf
file3.mp4
Subfolder1/
Subfolder2/
After Running
Downloads/
Images/
file1.jpg
Documents/
file2.pdf
Videos/
file3.mp4
Others/
Subfolder1/
Subfolder2/
To customise the file categories, open main.py
and edit the file_categories
dictionary. You can add, remove, or modify categories and their associated file extensions.
Invalid Path Error
If you see:
Invalid path. Please make sure the folder exists.
Ensure the folder path you entered is correct and accessible.
File/Folder Moving Errors
If you see errors like:
Error moving file/folder
Check:
- You have permission to modify the target directory.
- Files are not locked by another application.
Contributions are welcome! Feel free to fork the repository and submit a pull request.
This project is licensed under the MIT License.