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.
- Introduction
- Features
- Installation
- Usage
- Available Commands
- Project Structure
- Dependencies
- Testing
- Examples
- Troubleshooting
- License
✅ 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
- CMake (version 3.15 or later recommended)
- C++17 compatible compiler (GCC, Clang, etc.)
- Git
git clone <repository-url>
cd <repository-root>
mkdir build && cd build
cmake ..
make
To run tests:
ctest --output-on-failure
After building, run the CLI:
./cli
Example interaction:
Welcome to the File System!
Type 'help' to see available commands.
help
— Show help messageexit
— Exit the programclear
— Clear the terminal screenmakefs <path> <size> <cluster_size>
— Create a new file systemopenfs <path>
— Open an existing file systemfsinfo
— Display file system informationpwd
— Show current working directoryls [-l] <path>
— List directory contentsmkdir <path>
— Create a directorycd <path>
— Change directorytouch <path>
— Create an empty filecat <path>
— Print file contentsstat <path>
— Show file metadatarmdir <path>
— Remove directoryrm [-r] <path>
— Remove files or directoriescp [-r] <src> <dst>
— Copy files or directoriesmv [-r] <src> <dst>
— Move files or directoriesimport <host_path> <fs_path>
— Import file from hostexport <fs_path> <host_path>
— Export file to host
.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
- C++17 Standard Library
- CMake for building
- No external runtime dependencies required
Run tests after building:
ctest --output-on-failure
Unit tests cover:
- Directory and file operations
- FAT cluster management
- File read/write logic
- CLI command correctness
Create and use a file system:
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
- 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
This project is licensed under the terms of the LICENSE file included in the repository.