FileMan is a lightweight, cross-platform desktop file manager written in pure Java Swing. It lets you browse your file system and view file details. It can also open, edit, print, create, copy, rename and delete files and directories.
- Features
- Requirements
- Getting Started
- Usage
- Embedding FileMan in Your Application
- Project Structure
- Known Limitations
- Contributing
- License
- π³ File system tree: lazily loaded directory tree that shows the file system roots, with native system icons and display names.
- π Directory listing table: shows the contents of the selected directory in these columns:
- Icon, File name, Path, Size, Last Modified
- Readable (R), Writable (W), Executable (E), Directory (D) and File (F) flags
- π Live filtering: case-insensitive filtering of the directory listing by file name as you type.
βοΈ Sortable columns: click any column header to sort.- π±οΈ Double-click navigation: double-click a directory to open it, or a file to open it with its default system application.
- π File details panel: shows the file name, full path, last modified date, human-readable size (B, KB, MB, GBβ¦) and type.
- π οΈ File operations:
- Open, Edit and Print using the platform's default applications (via
java.awt.Desktop) - New file or directory
- Copy a file or directory to a chosen destination
- Copy / Paste using an internal clipboard
- Rename files and directories
- Delete files and directories, with recursive delete and a confirmation prompt
- Refresh the current directory
- Open, Edit and Print using the platform's default applications (via
- π Permission editing: toggle Read / Write / Execute permissions with checkboxes.
- β³ Responsive UI: directory loading runs in a background
SwingWorkerand shows a progress indicator. - π Status bar: shows item counts and the results of operations.
- β¨οΈ Keyboard shortcuts and mnemonics for common actions.
- π¨ Native look & feel: uses the system Look and Feel of your operating system.
β οΈ Overwrite protection: asks for confirmation before overwriting existing files during copy and paste.
- Java 8 or newer (JDK to build, JRE to run)
- Apache Maven 3.x to build the project
- Apache Commons IO, used for recursive copy and delete. Maven resolves it automatically.
- A desktop environment. FileMan is a GUI application and cannot run in a headless environment.
git clone https://github.com/javadev/file-manager.git
cd file-managermvn clean packageThe compiled artifacts are placed in the target/ directory.
Option 1: Using Maven
mvn compile exec:java -Dexec.mainClass="com.github.filemanager.FileManager"Option 2: Using the built JAR
java -jar target/file-manager-<version>.jarNote: If the produced JAR does not bundle its dependencies, add Commons IO to the classpath:
java -cp "target/classes:path/to/commons-io.jar" com.github.filemanager.FileManagerOn Windows, use
;instead of:as the classpath separator.
Option 3: From your IDE
Open the project as a Maven project in IntelliJ IDEA, Eclipse or NetBeans. Then run the main method of com.github.filemanager.FileManager.
+---------------------------------------------------------------------+
| File Edit Help |
+------------------+--------------------------------------------------+
| | Filter: [______________________________________] |
| File System | +----------------------------------------------+ |
| Tree | | Icon | File | Path/name | Size | Modified |β¦ | |
| | |------+------+-----------+------+----------+-- | |
| > Desktop | | β¦ | β¦ | β¦ | β¦ | β¦ | | |
| > Documents | +----------------------------------------------+ |
| > Downloads | [Open][Edit][Print] | [New][Copy][Rename] |
| > β¦ | [Delete][Refresh] | [ ]Read [ ]Write [ ]Execute|
| | |
| | File: example.txt |
| | Path/name: /home/user/example.txt |
| | Last Modified: 2025-01-01 12:00:00 |
| | File size: 1.23 KB (1260 bytes) |
| | Type: ( ) Directory (β’) File |
+------------------+--------------------------------------------------+
| Ready [progress bar] |
+---------------------------------------------------------------------+
- Left pane (tree): Select a directory to load its contents. Subdirectories are added to the tree as you explore.
- Right pane (table): Shows the contents of the selected directory. Select a row to see its details. Double-click a row to navigate into it or open it.
- Filter field: Type to filter the listing by file name.
- Toolbar: Runs actions on the currently selected file or directory.
- Details panel: Shows information about the current selection.
- Status bar: Shows feedback, such as item count or "Copied toβ¦", plus a progress indicator while directories load.
| Shortcut | Action |
|---|---|
F2 |
Rename selected file/directory |
Delete |
Delete selected file/directory |
F5 |
Refresh current directory |
Ctrl+C / β+C (macOS) |
Copy selected item to the internal clipboard |
Ctrl+V / β+V (macOS) |
Paste clipboard item into current directory |
Ctrl+N / β+N (macOS) |
Create a new file or directory |
Toolbar buttons also have mnemonics, such as Alt+O for Open, Alt+E for Edit, Alt+P for Print, Alt+N for New, Alt+C for Copy, Alt+R for Rename, Alt+D for Delete and Alt+F for Refresh.
- File: Newβ¦, Refresh, Exit
- Edit: Copy, Paste, Renameβ¦, Delete
- Help: About (shows a summary of shortcuts)
FileManager exposes its UI as a reusable Swing Container, so you can embed it in your own windows:
import com.github.filemanager.FileManager;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
public class MyApp {
public static void main(String[] args) {
SwingUtilities.invokeLater(() -> {
JFrame frame = new JFrame("My App with FileMan");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
FileManager fileManager = new FileManager();
frame.setContentPane(fileManager.getGui());
frame.setJMenuBar(fileManager.createMenuBar()); // optional
frame.pack();
frame.setLocationByPlatform(true);
frame.setVisible(true);
fileManager.showRootFile(); // select the first root node
});
}
}Public API:
| Method | Description |
|---|---|
Container getGui() |
Builds (once) and returns the main file manager panel. |
JMenuBar createMenuBar() |
Creates the File / Edit / Help menu bar. |
void showRootFile() |
Selects the first node in the file system tree. |
static boolean copyFile(File, File) |
Utility that copies a single file using NIO channels and keeps its permissions. |
Note: The File β Exit menu item calls
System.exit(0). If you embed FileMan in a larger application, you may want to provide your own menu bar.
file-manager/
βββ pom.xml
βββ LICENSE
βββ README.md
βββ src/
βββ main/
βββ java/
β βββ com/github/filemanager/
β βββ FileManager.java # Main class, FileTableModel, FileTreeCellRenderer
βββ resources/
βββ com/github/filemanager/
βββ fm-icon-16x16.png # Window icon (small)
βββ fm-icon-32x32.png # Window icon (large)
Main classes:
FileManager: the application entry point. It builds the GUI and implements the file operations.FileTableModel: anAbstractTableModelthat wraps aFile[]for the directory listing table.FileTreeCellRenderer: aDefaultTreeCellRendererthat shows native file icons and display names in the tree.
- Permanent deletion: Delete removes files and directories permanently, including all directory contents. Items do not go to the system Recycle Bin / Trash.
- Internal clipboard only: Copy/Paste uses an in-app clipboard. It does not connect to the operating system clipboard.
- Single selection: Only one file or directory can be selected at a time.
- Platform-dependent actions: Open, Edit and Print depend on
java.awt.Desktopsupport. They are disabled on platforms or file types that don't support them. - Permission changes: Read/Write/Execute changes use
java.io.Filepermission methods. Their behavior depends on the OS and file system. For example, Windows has limited support for removing read or execute permissions. - Headless environments: FileMan requires a graphical display.
Contributions are welcome! To contribute:
- Fork the repository: https://github.com/javadev/file-manager
- Create a feature branch:
git checkout -b feature/my-feature - Commit your changes:
git commit -am 'Add my feature' - Push the branch:
git push origin feature/my-feature - Open a Pull Request.
Please report bugs and request features through GitHub Issues.
This project is licensed under the MIT License. See the LICENSE file for details.