A lightweight, web-based file manager built in TCL using the wapp
framework. Browse directories, view files, and navigate your filesystem through a simple web interface.
- π Browse directories and files through a web interface
- π View file contents directly in the browser
- π Navigate through directories with clickable links
- π Lightweight and fast - built with pure TCL
- π Accessible from any web browser
- π± Simple, responsive HTML interface
- TCL 8.6+ (tested with TCL 8.6.14)
- tcllib package (provides
fileutil
utilities) - Unix-like system (Linux, macOS, WSL)
sudo apt update
sudo apt install tcl tcllib
# CentOS/RHEL
sudo yum install tcl tcllib
# Fedora
sudo dnf install tcl tcllib
brew install tcl-tk
# tcllib is usually included with tcl-tk on macOS
sudo pacman -S tcl tcllib
-
Clone the repository:
git clone https://github.com/yourusername/TCL-Web-File-Manager.git cd TCL-Web-File-Manager
-
Make the run script executable:
chmod +x run_server.sh
-
Start the server:
./run_server.sh
Or manually:
tclsh file_manager.tcl --server 8080
-
Open your browser: Navigate to
http://localhost:8080
The server starts on port 8080 by default. You can specify a different port:
tclsh file_manager.tcl --server 3000
- Click on directory names (ending with
/
) to browse into subdirectories - Click on file names to view file contents
- The server starts browsing from the current working directory
Press Ctrl+C
in the terminal where the server is running.
TCL-Web-File-Manager/
βββ file_manager.tcl # Main application file
βββ run_server.sh # Convenience script to start server
βββ lib/
β βββ wapp/ # Wapp framework files
β βββ wapp.tcl
β βββ wapp-routes.tcl
β βββ wapp-static.tcl
β βββ wapp-thread.tcl
βββ tests/
β βββ file_manager_test.tcl
β βββ manual/ # Sample files for testing
βββ README.md
render_file_manager
: Generates HTML directory listings with clickable navigation linkswapp-default
: Main request handler that serves files or directory listings based on the requested pathwapp
framework: Handles HTTP requests, routing, and HTML templating
- The server receives HTTP requests on the specified port
- The
wapp-default
procedure processes each request:- If the path is a file: displays file contents in a
<pre>
block - If the path is a directory: generates an HTML listing of contents
- If the path doesn't exist: shows "File Not Found" error
- If the path is a file: displays file contents in a
- Directory listings include clickable links for navigation
Run the test suite:
tclsh tests/file_manager_test.tcl
The tests/manual/
directory contains sample files of various types for testing the file viewer functionality.
Edit run_server.sh
or pass a different port when starting manually:
tclsh file_manager.tcl --server 9000
The server starts browsing from the current working directory. To serve a different directory:
cd /path/to/serve
tclsh /path/to/TCL-Web-File-Manager/file_manager.tcl --server 8080
- This application is intended for local development and testing only
- No input validation is performed on file paths
- Vulnerable to directory traversal attacks if exposed to untrusted networks
- No authentication or authorization mechanisms
- All files in the served directory are accessible via the web interface
- Add input validation and sanitization
- Implement authentication and authorization
- Use HTTPS instead of HTTP
- Restrict file access permissions
- Run behind a reverse proxy with security headers
- Consider using a more robust web framework
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
"can't find package fileutil"
# Install tcllib package
sudo apt install tcllib # Ubuntu/Debian
sudo yum install tcllib # CentOS/RHEL
"Permission denied" when running run_server.sh
chmod +x run_server.sh
Server not accessible from other machines The server binds to localhost by default. To make it accessible from other machines, you may need to modify the wapp configuration (consult wapp documentation for network binding options).
- wapp: Minimalistic web application framework for TCL (included in
lib/wapp/
) - fileutil: File utilities from tcllib package
- TCL 8.6+: Core TCL interpreter