dir-tidy is a simple command-line tool that organizes files in a specified directory into categorized subfolders based on their file types. It ensures your directories stay clean and organized, saving you the hassle of manually sorting files.
- Automatically categorizes files into subfolders (e.g., images, videos, documents).
- Handles file naming conflicts by appending a counter to duplicate filenames.
- Supports a variety of file types with customizable mappings.
- Provides a detailed summary of the organization process.
First, make sure you have Node.js installed on your machine.
-
Install
dir-tidy
globally from npm:npm install -g dir-tidy
-
Verify the installation:
dir-tidy --version
Run the dir-tidy
command, providing the path to the directory you want to organize.
dir-tidy <directory-path>
dir-tidy /home/user/Downloads
The tool organizes files in the specified directory into subfolders such as images-png
, videos-mp4
, documents-pdf
, etc., and provides a summary like this:
Organization Summary for '/home/user/Downloads':
- Folder: images-png
- Created
- Files added: 3
- Folder: videos-mp4
- Already existed
- Files added: 2
- Folder: others-zip
- Created
- Files added: 1
File Extension | Folder Name |
---|---|
.png |
images-png |
.jpg |
images-jpg |
.jpeg |
images-jpeg |
.mp4 |
videos-mp4 |
.avi |
videos-avi |
.pdf |
documents-pdf |
Other file types are moved to a folder named others-<extension>
.
If the directory path provided is invalid or not a directory, dir-tidy
will show an error:
The provided path is not a directory: /invalid/path
Make sure the directory exists and is accessible.
-
Clone the repository:
git clone https://github.com/code-env/tidyup.git
-
Install dependencies:
npm install
-
Build the project:
npm run build
-
Test locally:
node ./dist/index.js <directory-path>
Contributions are welcome! If you'd like to add new features or improve the project:
- Fork the repository
- Create a new branch for your changes
- Submit a pull request
This project is licensed under the ISC License. See the LICENSE file for more details.
dir-tidy is developed and maintained by bossadizenith.
Happy organizing! 🚀