AutoSort is a powerful and intuitive command-line tool to organize files in a folder. Designed to be simple yet elegant, it provides flexible sorting options for files by name, extension, or creation date. With support for recursive folder sorting and real-time monitoring, AutoSort is the perfect tool to keep your files organized.
- Sort by File Type (Extension) (Default): Organize files based on their extensions.
- Sort by Name: Organize files alphabetically by their first letter.
- Sort by Creation Date: Group files based on their creation date.
-
Recursive Sorting: Sort files in all subdirectories with the
--sub
option. -
Active Mode: Watch a folder for changes and sort files automatically with the
--active
option. - Dry Run: Simulate the sorting process to see what would happen without making changes.
- Logging: Keep a detailed log of all actions performed.
- Color-Coded Outputs: Intuitive and colorful output for clear feedback.
- Cross-Platform: Works on Windows, macOS, and Linux.
-
Add through NPM:
npm install autosort
-
Run using default settings:
autosort .
Run autosort
followed by the folder you want to organize.
autosort /path/to/folder [options]
Option | Alias | Description |
---|---|---|
--name |
-n |
Sort files by their first letter. |
--extension |
-e |
Sort files by their file type (extension). |
--date |
-d |
Sort files by their creation date. |
--sub |
-s |
Sort files in all subdirectories recursively. |
--active |
-a |
Watch the folder for changes and sort files automatically. |
--dry |
Simulate sorting without making changes. | |
--log |
-l |
Generate a log file of actions taken. |
--help |
-h |
Show help. |
autosort /path/to/folder
autosort /path/to/folder --name
autosort /path/to/folder --date --sub
autosort /path/to/folder --extension --dry
autosort /path/to/folder --active
autosort /path/to/folder --log
If the --log
option is used, AutoSort generates a log file in the folder being sorted. The file is named based on the current timestamp. For dry runs, the log file includes [TEST]
entries.
Example log file:
Test Run Log - 2025-01-04 15:00:00
[TEST] Would move: /path/to/folder/file1.txt → /path/to/folder/TXT/file1.txt
[TEST] Would move: /path/to/folder/file2.jpg → /path/to/folder/JPG/file2.jpg
Clone the repository:
git clone https://github.com/smirki/autosort.git
cd autosort
Install dependencies:
npm install
Link the script to npm for testing:
npm link
You can now use the autosort
command globally:
autosort /path/to/folder --name
autosort/
├── autosort.js # Main script file
├── package.json # Project configuration
├── README.md # Documentation
├── .gitignore # Ignored files
├── node_modules/ # Installed dependencies
We welcome contributions! To contribute:
- Fork the repository.
- Create a new branch for your feature/fix.
- Commit your changes.
- Submit a pull request.
This project is licensed under the MIT License. See the LICENSE
file for details.
For support or inquiries, feel free to contact:
Manav Majumdar
GitHub: smirki