This project is a basic file sorter script in Python. It uses only the Python Standard Library and, as such, can be used after installing Python itself.
The script will attempt to sort any files of a current working directory based on their file extension. This is into 1 of 12 newly created directory groupings inside of the current working directory. To view these groupings and relating outputs, reference the "What is the output?" section.
To run this script, simply run the file_sorter.py with the optional argument of <path_to_dir_to_sort>. This would look like python file_sorter.py C:\Users\<user>\<path>\<to>\<directory> for a Windows system. The script will then open a very simplistic GUI for configuration of sorting which will run in one of three modes: move, copy, or list. Move will physically move all sorted files into a new directory, copy will only move a copy of these files into a new directory, and list will only output the sorted text log files. To start the program, enter the path to a directory which you wish to sort, choose a mode, then press the 'submit' button.
As stated, this program outputs all files moved, or sorted, into new directories relating to their extension, along with a "moved_lists" directory that contains logs of all moved or to be moved files. These new directories are grouped in format <description> (<new_dir_name>), as follows:
-
Compressed Files (compressed_files):
- .zip
- .gz
- .tar
- .7z
- .rar
-
Image Files (image_files):
- .png
- .jpg / .jpeg
- .gif
- .svg
- .webp
- .bmp
- .raw
-
Document Files (document_files):
- .doc
- .docx
- .rtf
- .odt
-
Text-Like Formatted Files (text_document_files):
- .txt
- .json
- .xml
- .yaml
- .yml
- .ini
- .md
-
Video and Audio Files (multimedia_files):
- .mp3
- .mp4
- .wav
- .avi
- .mov
- .mkv
-
Spreadsheet Files (spreadsheet_files):
- .xlsx
- .xls
- .csv
-
Presentation Files (presentation_files):
- .pptx
- .ppt
-
Runnable Files (program_files):
- .exe
- .jar
- .deb
- .msi
- .cmd
- .com
- .sys
- .app
- .dmg
- .pkg
- .rpm
- .bin
- .apk
- .ipa
-
Editing Software Save Files (editing_files):
- .afdesign
- .afphoto
- .psf
- .psb
- .xcf
- .ai
- .cdr
- .fig
- .kra
- .clip
- .rif
- .procreate
- .xmp
- .piskel
- .mlt
-
Web-Based Files (web_files)
- .html
- .htm
- .css
- .js
- .php
-
Script-Based Files (script_files):
- .bat
- .sh
- .py
- .ts
- .rb
- .pl
- .lua
-
Compile-Based Files (code_files):
- .c
- .h
- .cpp
- .cc
- .hpp
- .java
- .cs
- .go
- .rs
- .swift