Python script for automatically organizing and sorting files in the current directory
- Python 100%
| .forgejo/workflows | ||
| main.py | ||
| README.md | ||
Sort Your Files
A script in Python for automatically organizing and sorting files in the current directory based on their extensions and execution permissions.
Features
- Automatic file categorization: Moves files from the current directory to appropriately named subdirectories.
- Supported categories:
- Images:
.jpg,.jpeg,.png,.gif,.bmp,.tiff,.svg,.webp,.avif,.psd,.ico,.jfif - Docs:
.pdf,.docx,.txt,.xlsx,.pptx,.csv,.doc,.djvu,.rtf,.crx,.odt - Audio:
.mp3,.wav,.aac,.flac,.ogg,.m4a,.opus,.weba - Videos:
.mp4,.avi,.mov,.mkv,.m4v,.mpg4,.webm,.mpeg - Archives:
.zip,.rar,.tar,.gz,.7z,.iso,.zst,.tgz,.bz2,.lz,.liz,.lz4,.lz5,.wim,.xz - MCPACKS:
.mcpack,.mcworld - Others:
.json,.js,.torrent,.mhtml,.html,.mht,.xml,.apk,.apkm,.ps1,.rbxl,.rbxm,.lua,.ini,.rdp,.jar - Programs:
.exe,.msi,.cmd,.bat,.sh,.AppImageand files with execution permissions in Unix/Linux systems.
- Images:
- Automatic folder creation: Target folders are created dynamically as needed.
- Configure folder structure: You can configure the folder structure by editing
main.pyfile.
Requirements
- Python 3.9 or higher
Usage
Run the script in the directory to be sorted:
python main.py
Folder structure
The script creates only the following subdirectories when it finds any file with the specified extension.
Images/
Docs/
Audio/
Videos/
Archives/
MCPACKS/
Others/
Programs/