A command-line file management utility built with C# and .NET.
This project provides a simple CLI for working with local files. It was built to practice C# file-system operations, classes, methods, path handling, and resource management through a small, structured application.
- Create new files
- Select an existing working file
- Read file contents
- Overwrite file contents
- Append data to a file
- Delete files
- Prevent deletion of the currently active working file
- Protect
data.txtas a permanent file - Automatically work with files inside the project's
Filesdirectory - Separate file operations into dedicated classes
FileSystem CLI - C#
│
├── Operations/
│ ├── File_creator.cs
│ ├── File_deleter.cs
│ ├── File_selector.cs
│ ├── file_Writer.cs
│ └── Reader.cs
│
├── Files/
│ └── data.txt
│
├── Program.cs
├── FileSystem CLI - C#.csproj
├── .gitignore
├── README.md
│
├── bin/ # Build output
└── obj/ # Intermediate build files
bin/andobj/are generated by .NET and should not be committed to the repository.
Handles the main application flow, menu, user input, and calls the appropriate file operation.
Creates new files inside the Files directory.
Allows the user to create a new file or select an existing file as the current working file.
Reads and displays the contents of the selected file using StreamReader.
Handles both:
- Overwriting existing file content
- Appending new content
It uses StreamWriter.
Handles file deletion while applying the project's deletion rules:
- The current working file cannot be deleted.
data.txtcannot be deleted.- A file must exist before it can be deleted.
The application keeps files inside:
Files/
data.txt is treated as the permanent file and cannot be deleted.
The currently selected working file cannot be deleted. This prevents the application from removing the file that is currently being used.
The application provides the following operations:
<--- File Manager --->
1. Create another file
2. Read the working file
3. Overwrite working file
4. Append data to working file
5. Delete working file
6. Change the Working File
7. Exit
- C#
- .NET
System.IOFileDirectoryPathStreamReaderStreamWriter
This project focuses on practical C# fundamentals:
- Classes and objects
- Methods
ifstatementsswitchstatements- Loops
- Arrays
- String handling
- Nullable values
TryParse- File handling
- Directory handling
- Path handling
usingstatements- Resource disposal
- Multiple source files
- Separation of responsibilities
Install the .NET SDK.
Check your installed version:
dotnet --versiongit clone <your-repository-url>Move into the project directory:
cd FileSystem-CLIdotnet runAfter creating additional files, the Files directory may look like:
Files/
├── data.txt
├── notes.txt
└── project.txt
The application can then select these files and perform the supported operations through the CLI.
The project separates responsibilities into individual classes:
Program
│
├── File_creator
├── File_selector
├── Reader
├── file_Writer
└── File_deleter
This keeps Program.cs focused on application flow while individual classes handle specific file operations.
Possible future additions:
- Rename files
- Copy files
- Move files
- Display file size
- Display file creation and modification dates
- Search files
- Create directories
- Delete directories
- Add confirmation before deleting files
- Improve CLI navigation
This project is intended for educational and personal use.