Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

📁 File Management CLI

A Python command-line tool for managing files and directories.

This project provides two main features:

  1. Organizing files based on their extensions
  2. Automatically creating files and directories from a JSON configuration

The application is designed to be used through the command line with Python argument parsing.


✨ Features

📂 1. File Organizer

The file organizer scans a directory and organizes files based on their extensions.

For example, if a directory contains:

my_folder/
├── document.txt
├── notes.txt
├── image.png
├── photo.jpg
├── script.py
└── data.json

After running the organizer, the files are grouped into directories based on their extensions

```text
my_folder/
├── txt/
│   ├── document.txt
│   └── notes.txt
│
├── png/
│   └── image.png
│
├── jpg/
│   └── photo.jpg
│
├── py/
│   └── script.py
│
└── json/
    └── data.json

📦 2. File Clustering

The organizer also supports dividing files into smaller groups.

For example, using:

--cluster 5

files can be divided into groups of five inside numbered directories.

Example:

txt/
├── 1/
│   ├── file01.txt
│   ├── file02.txt
│   ├── file03.txt
│   ├── file04.txt
│   └── file05.txt
│
└── 2/
    ├── file06.txt
    ├── file07.txt
    └── file08.txt

🏗️ 3. Automatic File & Directory Creation

The second feature allows you to define a directory structure inside a JSON configuration file.

The program reads the configuration and automatically creates the required directories and files.

This can also be used for nested directory structures.

Example:

project/
├── src/
│   ├── main.py
│   └── utils.py
│
├── tests/
│   └── test_main.py
│
└── README.md

The structure can be represented using a JSON configuration file, and the program will create it automatically.

This makes it possible to create complex directory structures without manually creating every file and folder.

🛠️ Technologies

  • Python
  • Object-Oriented Programming
  • argparse
  • JSON
  • File System Operations

💻 Usage

The application provides two main commands:

sort create

📂 Sort Files

The sort command organizes files in a directory based on their extensions.

Basic Usage

python file_manager.py sort --path ./my_folder/

This scans the specified directory and moves files into directories based on their extensions.

📦 Sort Files into Clusters

You can also divide files into groups using the --cluster option.

For example:

python file_manager.py sort --path ./my_folder/ --cluster 5

This organizes the files and divides them into groups of five.

🏗️ Create Files and Directories

The create command creates a directory and file structure based on a JSON configuration file.

python file_manager.py create --config-file config.json

The --config-file option specifies the path to the JSON configuration containing the desired structure.

🚀 Getting Started

1. Clone the Repository

git clone https://github.com/alimhmdabesi/file-management-cli.git
cd file-management-cli

# Run 
python file_manager.py

About

A Python command-line tool for organizing files by extension and creating file structures from JSON configuration.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages