Skip to content

continuum235/DirectoryOpener

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

Directory Opener

Like code . use to open the vscode from the terminal. Its a CLI-to-GUI File Navigation Tool which allows us to open the common directory from the terminal using their name itself.
Type Desktop, Downloads, Pictures (and more) anywhere in your terminal to instantly open that folder in your GUI file manager.


How It Works

diropen is a single self-contained binary. When you run diropen install, it:

  1. Copies itself into a dedicated bin directory under your user profile
  2. Creates one named executable per common directory (Desktop.exe, Downloads.exe, etc.)
  3. Adds that bin directory to your user PATH — permanently, no admin rights needed

When you later type Desktop in a terminal, the matching executable runs and opens ~/Desktop in your GUI file manager (explorer on Windows, xdg-open on Linux, open on macOS).


Build from Source

Requires Go 1.21+.

# Clone / enter the repo
git clone https://github.com/continuum235/CLI-to-GUI-File-Navigation-Tool.git
cd CLI-to-GUI-File-Navigation-Tool

# Build for your current platform
go build -o diropen main.go          # Linux / macOS
go build -o diropen.exe main.go      # Windows (PowerShell)

Cross-compile

# Windows → Linux
GOOS=linux GOARCH=amd64 go build -o diropen main.go

# Windows → macOS (Apple Silicon)
GOOS=darwin GOARCH=arm64 go build -o diropen main.go

# Linux/macOS → Windows
GOOS=windows GOARCH=amd64 go build -o diropen.exe main.go

Installation

Windows (PowerShell)

# 1. Build
go build -o diropen.exe main.go

# 2. Install shortcuts + add to PATH
.\diropen.exe install

What install does on Windows:

  • Creates %LOCALAPPDATA%\diropen\bin\
  • Writes Desktop.exe, Documents.exe, Downloads.exe, Music.exe, Pictures.exe, Videos.exe there
  • Adds the bin folder to your user PATH via the registry (HKCU\Environment) — no admin needed

Activate in the current terminal (without opening a new one):

$env:PATH = [System.Environment]::GetEnvironmentVariable('Path','Machine') + ';' + [System.Environment]::GetEnvironmentVariable('Path','User')

Or just open a new terminal — the PATH loads automatically on every new session.


Linux

# 1. Build
go build -o diropen main.go

# 2. Install shortcuts + symlinks
./diropen install

What install does on Linux:

  • Creates common dirs under ~/ if they don't exist
  • Places a hidden copy of itself inside each dir (e.g. ~/Desktop/.Desktop)
  • Creates lowercase symlinks in ~/.local/bin/desktop, documents, downloads, etc.

Activate in the current shell (or add to ~/.bashrc / ~/.zshrc):

export PATH="$HOME/.local/bin:$PATH"

To make it permanent, add that line to your shell profile:

echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc

Shortcuts installed:

Command Opens
desktop ~/Desktop
documents ~/Documents
downloads ~/Downloads
music ~/Music
pictures ~/Pictures
videos ~/Videos
templates ~/Templates
public ~/Public

Note: Linux uses lowercase command names (desktop, not Desktop).
Requires a desktop environment with xdg-open — works with GNOME, KDE, XFCE, and most others.


macOS

# 1. Build
go build -o diropen main.go

# 2. Install shortcuts + symlinks
./diropen install

What install does on macOS:

  • Places a hidden copy of itself inside each dir (e.g. ~/Desktop/.Desktop)
  • Creates lowercase symlinks in ~/.local/bin/desktop, documents, downloads, etc.

Activate in the current shell (or add to ~/.zshrc):

export PATH="$HOME/.local/bin:$PATH"

To make it permanent:

echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

Shortcuts installed:

Command Opens
desktop ~/Desktop
documents ~/Documents
downloads ~/Downloads
music ~/Music
pictures ~/Pictures
movies ~/Movies
public ~/Public

Uses macOS open command — opens in Finder automatically.


Usage

All platforms follow the same pattern after install:

<DirName>                   Open the named home directory
<DirName> .                 Open the current working directory
<DirName> <subfolder>       Open ~/DirName/subfolder
<DirName> /absolute/path    Open an absolute path

Examples

# Windows
Desktop                     # opens C:\Users\<you>\Desktop
Downloads                   # opens C:\Users\<you>\Downloads
Downloads .                 # opens current directory in Explorer
Pictures vacation           # opens C:\Users\<you>\Pictures\vacation
# Linux / macOS
desktop                     # opens ~/Desktop
downloads                   # opens ~/Downloads
downloads .                 # opens current directory in Nautilus/Finder
pictures vacation           # opens ~/Pictures/vacation
# Any platform — open an arbitrary path
diropen .                   # open current directory
diropen /some/path          # open any absolute path

Uninstall

Windows

# Remove the bin directory
Remove-Item -Recurse -Force "$env:LOCALAPPDATA\diropen"

# Remove from user PATH (open System Properties > Environment Variables,
# or use PowerShell):
$current = [System.Environment]::GetEnvironmentVariable('Path','User')
$new = ($current -split ';' | Where-Object { $_ -notlike '*diropen*' }) -join ';'
[System.Environment]::SetEnvironmentVariable('Path', $new, 'User')

Linux / macOS

# Remove symlinks
rm ~/.local/bin/desktop ~/.local/bin/documents ~/.local/bin/downloads \
   ~/.local/bin/music ~/.local/bin/pictures ~/.local/bin/videos

# Remove hidden binaries (optional)
rm ~/Desktop/.Desktop ~/Documents/.Documents ~/Downloads/.Downloads \
   ~/Music/.Music ~/Pictures/.Pictures ~/Videos/.Videos

Troubleshooting

Problem Fix
Command not found right after install (Windows) Run the $env:PATH = ... one-liner printed by install, or open a new terminal
Command not found right after install (Linux/macOS) Run export PATH="$HOME/.local/bin:$PATH" or open a new shell
xdg-open not found (Linux) Install xdg-utils: sudo apt install xdg-utils or equivalent
No GUI (headless Linux server) This tool requires a desktop environment — not designed for headless use
Permission denied writing bin dir Make sure you have write access to %LOCALAPPDATA% / ~/.local/bin

File Manager Used Per Platform

OS File Manager Command Opens in
Windows explorer <path> Windows Explorer
macOS open <path> Finder
Linux xdg-open <path> Default DE file manager (Nautilus, Dolphin, Thunar, etc.)

improvenments

current system:

Creates many copies of the binary

Better approach:

Keep one binary

Use symlinks only

Existing Solution

xdg-open ~/Desktop xdg-open ~/Downloads xdg-open ~/Pictures

its definately widely used but i dont care...i just did this for my own conviences

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages