Skip to main content

AutoFiler

·249 words·2 mins
Oğuzhan Kuşca
Author
Oğuzhan Kuşca
Hi I’m Oğuzhan. With a Management Information Systems (MIS) perspective, I optimize operational workflows using Linux & Python and analyze tech strategies. I stand where code transforms into business value.
Table of Contents

AutoFiler
#

AutoFiler is a lightweight, efficient Python automation script designed to organize cluttered directories instantly. It scans your Downloads folder (or any target directory) and categorizes files into subfolders based on their extensions.

“Turn chaos into order with a single command.”


Features
#

  • Dynamic Path Detection: Automatically detects the user’s home directory and locates the Downloads folder on Linux, Windows, and macOS.
  • Smart Categorization: Uses a dictionary-based mapping system to sort files into specific categories (Images, Documents, Archives, etc.).
  • Safe Execution:
    • Skips hidden files (dotfiles) and existing directories.
    • Includes try-except blocks to handle permission errors or file conflicts gracefully.
    • Checks if the target folder exists before attempting operations.
  • Universal Compatibility: Uses os.path.join for cross-platform compatibility.

How It Works
#

Before:

Downloads/
├── homework.docx
├── vacation.jpg
├── installer.exe
├── song.mp3
└── archive.zip

After Running AutoFiler:

Downloads/
├── Documents/
│   └── homework.docx
├── Images/
│   └── vacation.jpg
├── Setup_Files/
│   └── installer.exe
├── Music/
│   └── song.mp3
└── Archives/
    └── archive.zip

Installation & Usage
#

1. Clone the Repository
#

git clone https://github.com/kuscadev/autofiler.git
cd autofiler
  • (For Linux) Run the installer:

    chmod +x install.sh
    ./install.sh

    Now you can run it from anywhere by typing autofiler.

2. Run the Script
#

No external libraries required! It runs on standard Python 3 libraries (os, shutil).

python3 autofiler.py

3. Customize (Optional)
#

You can modify the DIR_TYPES dictionary in autofiler.py to add new extensions or change folder names:

DIR_TYPES = {
    "Images": (".jpg", ".png", ".gif"),
    "My_Project_Files": (".blend", ".psd") # Add your own rules!
}