https://github.com/gregorykogan/file-system
C++ virtual file system emulator with FAT structure, supporting directories, files, metadata, and cluster-based storage.
https://github.com/gregorykogan/file-system
cli command-line-tool cpp data-storage educational fat file-allocation file-management filesystem filesystem-emulator learning-project storage-emulator
Last synced: 11 months ago
JSON representation
C++ virtual file system emulator with FAT structure, supporting directories, files, metadata, and cluster-based storage.
- Host: GitHub
- URL: https://github.com/gregorykogan/file-system
- Owner: GregoryKogan
- License: gpl-3.0
- Created: 2023-11-27T15:27:19.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-06-28T22:05:34.000Z (12 months ago)
- Last Synced: 2025-06-28T23:19:28.956Z (12 months ago)
- Topics: cli, command-line-tool, cpp, data-storage, educational, fat, file-allocation, file-management, filesystem, filesystem-emulator, learning-project, storage-emulator
- Language: C++
- Homepage:
- Size: 1.16 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# FAT File System Emulator



## Introduction
This project is a custom-built file system emulator written in C++, simulating core file system operations like creating, reading, writing, copying, and removing files and directories. It offers a fully functional Command-Line Interface (CLI) for interacting with the virtual file system. This project provides an educational and testable environment to understand file system behaviors and operations.
## Table of Contents
* [Introduction](#introduction)
* [Features](#features)
* [Installation](#installation)
* [Usage](#usage)
* [Available Commands](#available-commands)
* [Project Structure](#project-structure)
* [Dependencies](#dependencies)
* [Testing](#testing)
* [Examples](#examples)
* [Troubleshooting](#troubleshooting)
* [License](#license)
## Features
✅ Custom file system with cluster-based storage
✅ FAT (File Allocation Table) management
✅ Directory structure and metadata handling
✅ File read/write, import/export, and copy/move functionalities
✅ CLI for interactive user commands
✅ Unit tests for critical components
✅ Cross-platform build via CMake and GitHub Actions
## Installation
### Prerequisites
* CMake (version 3.15 or later recommended)
* C++17 compatible compiler (GCC, Clang, etc.)
* Git
### Build Steps
```bash
git clone
cd
mkdir build && cd build
cmake ..
make
```
To run tests:
```bash
ctest --output-on-failure
```
## Usage
After building, run the CLI:
```bash
./cli
```
Example interaction:
```bash
Welcome to the File System!
Type 'help' to see available commands.
```
## Available Commands
* `help` — Show help message
* `exit` — Exit the program
* `clear` — Clear the terminal screen
* `makefs ` — Create a new file system
* `openfs ` — Open an existing file system
* `fsinfo` — Display file system information
* `pwd` — Show current working directory
* `ls [-l] ` — List directory contents
* `mkdir ` — Create a directory
* `cd ` — Change directory
* `touch ` — Create an empty file
* `cat ` — Print file contents
* `stat ` — Show file metadata
* `rmdir ` — Remove directory
* `rm [-r] ` — Remove files or directories
* `cp [-r] ` — Copy files or directories
* `mv [-r] ` — Move files or directories
* `import ` — Import file from host
* `export ` — Export file to host
## Project Structure
```
.github/workflows/ # CI/CD configuration for multi-platform builds
assets/ # Sample files for import/export testing
src/ # Core source code
├── CLI/ # Command-Line Interface implementation
├── FileSystem/ # File system components (FAT, Metadata, File Handlers, etc.)
tests/ # Unit and integration tests
CMakeLists.txt # Build configuration
README.md # Project documentation
LICENSE # License information
```
## Dependencies
* C++17 Standard Library
* CMake for building
* No external runtime dependencies required
## Testing
Run tests after building:
```bash
ctest --output-on-failure
```
Unit tests cover:
* Directory and file operations
* FAT cluster management
* File read/write logic
* CLI command correctness
## Examples
Create and use a file system:
```bash
makefs myfs.fs 1048576 256
openfs myfs.fs
mkdir /docs
touch /docs/readme.txt
import hostfile.txt /docs/readme.txt
ls /docs
cat /docs/readme.txt
export /docs/readme.txt exported.txt
```
## Troubleshooting
* **Cannot open file system**: Ensure the `.fs` file exists and is accessible
* **Command not recognized**: Use `help` to verify command syntax
* **Build issues**: Confirm correct compiler and CMake version installed
## License
This project is licensed under the terms of the [LICENSE](LICENSE) file included in the repository.