A simple Python-based file management system built to study, understand, and demonstrate text file manipulation in Python. This educational project provides an interactive command-line interface for creating, reading, updating, and deleting .txt files.
This project was developed for educational purposes to demonstrate fundamental file operations in Python. It features a clean separation of concerns with a FileManager class handling file I/O operations and a UIManager class managing the user interface.
- Read files: View the contents of existing
.txtfiles - Create files: Write new text files with multi-line content
- Append data: Add content to existing files
- Rename files: Change file names
- Delete files: Remove files from the system
- Built-in documentation: View program documentation directly from the interface
- Python 3.10+ (uses
match-casestatements) - PyInstaller - For building standalone executables
-
Clone the repository:
git clone https://github.com/egwolk/python-txt-file-management.git cd data-science-study -
(Optional) Set up a virtual environment:
# Create virtual environment python -m venv venv # Activate virtual environment venv\Scripts\activate
-
Run the program:
python main.py
The program will start and display an interactive menu where you can select options 1-7.
-
(Optional) Set up and activate virtual environment (see step 2 above)
-
Install PyInstaller:
pip install pyinstaller
-
Build the executable:
pyinstaller --onefile --name "Text File Manager" main.pyThe executable will be created in the
dist/directory.Alternative: Use the existing spec file:
pyinstaller "Text File Manager.spec" -
Run the executable:
dist\Text File Manager.exe
- Go to the Releases page
- Download
Text File Manager.exe - Double-click to run, or open Command Prompt and run:
"Text File Manager.exe"
data-science-study/
├── main.py # Entry point of the application
├── file_manager.py # File operations class
├── ui_manager.py # User interface class
├── Text File Manager.spec # PyInstaller configuration
├── README.md # Project documentation
├── build/ # PyInstaller build files
└── dist/ # Compiled executables
-
Run the program using one of the methods above
-
Select an option from the menu (1-7):
- [1] Read a file - View contents of an existing file
- [2] Create a new file - Write content to a new file
- [3] Add data to a file - Append content to an existing file
- [4] Rename a file - Change the name of an existing file
- [5] Delete a file - Remove a file
- [6] Read program docs - View built-in documentation
- [7] Exit - Close the program
-
Follow the on-screen prompts for each operation
-
File names without
.txtextension will automatically have it added
- Windows 10 or later (for pre-built executable)
- Python 3.10 or higher (for running from source - uses
match-casesyntax) - No external dependencies for running from source
- PyInstaller required only for building executables
This project is for educational purposes.
made with 💗 @egwolk