This is a simple File Management System written in C language. It simulates a file system with basic functionalities such as creating files, inserting records, searching records, deleting records, defragmenting files, compacting memory, and more.
- Initialize memory for the file system
- Create files with specified record count, contiguity, and sorting options
- Insert records into files
- Search for records by ID
- Logically and physically delete records
- Defragment files to remove logically deleted records
- Compact memory to optimize space usage
- Display the current state of memory and file metadata
- Delete files and rename files
- Generate sample data for testing
file_system.c: Contains the implementation of the file system functions.file_system.h: Contains the declarations of the file system functions and data structures.main.c: Contains the main function and the menu for interacting with the file system.README.md: This file.
-
Compile the project using a C compiler. For example:
gcc main.c file_system.c -o file_system
-
Run the compiled executable:
./file_system
-
Follow the menu options to interact with the file system.
- Initialize Memory: Initialize the file system with a specified number of blocks and block size.
- Create File: Create a new file with a specified name, record count, contiguity, and sorting options.
- Display Memory State: Display the current state of memory blocks.
- Display Metadata: Display metadata of all files in the file system.
- Insert Record: Insert a new record into a specified file.
- Search Record: Search for a record by ID in a specified file.
- Delete Record: Delete a record by ID in a specified file (logical or physical deletion).
- Defragment File: Defragment a specified file to remove logically deleted records.
- Compact Memory: Compact memory to optimize space usage.
- Delete File: Delete a specified file from the file system.
- Rename File: Rename a specified file.
- Clear Filesystem: Clear all files and reset the file system.
- Generate Sample Data: Generate sample data for a specified file.
- Quit: Exit the file system simulator.
Record: Represents a record in a file.Metadata: Represents metadata of a file.Block: Represents a block in the file system.FileSystem: Represents the file system.