Getting Started
dir2 provides a unique approach to file system interaction by using SQL-like syntax. Instead of traditional navigation commands, you query your file system like a database.
Launching dir2
Inside the directory_2 folder run
cargo run
You'll see the dir2 prompt:
dir2>
Essential Commands
Try these basic commands to get familiar with dir2:
LC
List Commands - Shows all available commands in dir2
LD
List Directory - Lists all files and folders in the current directory
WD <directory_name>
Watch Directory - Change to a specific directory by name
CD drive
Change Drive - Navigate to a different drive
SELECT filename FROM path
Select File - Load a file into the current state for operations
VIEW STATE
View Current State - Shows the currently selected file (short: VS)
RUN STATE
Execute File - Runs the currently selected file (short: RS)
FIND EXACT filename
Find File - Search for a file across the entire system (short: FE)
FAV VIEW
View Favorites - Shows all saved favorite files with their index numbers
CLS
Clear Screen - Clears the terminal screen (short: /C)
Basic Concepts
Understanding these core concepts will help you master dir2's approach to file management.
Stateful File Management
dir2 maintains a current file state. When you SELECT a file, it becomes the active file for subsequent operations:
SELECT document.txt FROM C:\Users\Documents\
Now document.txt
is loaded into the current state and ready for operations.
SQL-Like Syntax
Commands follow familiar SQL patterns:
- SELECT: Choose files from directories
- FROM: Specify the source directory
- STATE: Current file in memory for operations
Path Formats
dir2 supports various path formats for Windows:
- Absolute paths:
C:\Users\Documents\
- Relative paths:
.\subfolder\
- Home directory:
~\Documents\
- Current directory:
.
File Selection
The SELECT command is the cornerstone of dir2. It loads files into the current state for further operations.
Basic File Selection
SELECT filename.txt FROM C:\Path\To\Directory\
Checking Current State
After selecting a file, check what's currently loaded:
VIEW STATE
Or use the short form:
VS
Selection Examples
Select from Current Directory
SELECT script.py FROM .
Selects script.py from the current working directory
Select from Documents
SELECT report.pdf FROM C:\Users\Documents\
Selects report.pdf from your Documents folder
Select Executable
SELECT app.exe FROM C:\Program Files\MyApp\
Selects an executable file for later execution
View File Metadata
META STATE
View metadata of the currently selected file
State Management
Manage your current file state step by step:
Select a file:
SELECT config.ini FROM C:\App\
Check what's selected:
VIEW STATE
View file metadata:
META STATE
Clear the state when done:
DROP STATE
File Execution
Once you have a file selected in state, you can execute it using the RUN STATE command.
Basic Execution
Execute the currently selected file:
RUN STATE
Or use the short form:
RS
Execution Examples
Python Scripts
SELECT data_analysis.py FROM C:\Projects\
RUN STATE
This will execute: python data_analysis.py
Executable Files
SELECT notepad.exe FROM C:\Windows\System32\
RUN STATE
This will launch Notepad
Batch Files
SELECT deploy.bat FROM .\scripts\
RUN STATE
This will execute the batch file
Favorites System
The favorites system allows you to save frequently used files for instant access using index numbers.
Adding to Favorites
Add the currently selected file to favorites:
FAV SET STATE
Using Favorites
View all favorites with their index numbers:
FAV VIEW
Execute a favorite by its index:
RUN FAV 1
Managing Favorites
View All Favorites
FAV VIEW
Display all saved favorites with index numbers
Remove Favorite
FAV RM 3
Remove favorite at index 3
Add Current File
FAV SET STATE
Add currently selected file to favorites
Run Favorite
RUN FAV 2
Execute favorite file at index 2
Favorites Workflow Example
Select and add a commonly used tool:
SELECT backup.py FROM C:\Scripts\
FAV SET STATE
View favorites list:
FAV VIEW
Later, run it directly by index:
RUN FAV 1
File Search
dir2 provides powerful search capabilities to find files across your entire system and search the web.
Exact File Search
Find exact file matches system-wide:
FIND EXACT config.json
Or use the short form:
FE config.json
Web Search
Search the web directly from dir2:
Google Search
SEARCH GOOGLE "rust tutorial"
Search Google (short: S G rust tutorial)
DuckDuckGo Search
SEARCH DDG "privacy tools"
Search DuckDuckGo (short: S D privacy tools)
ChatGPT Query
SEARCH CHATGPT "explain recursion"
Query ChatGPT (short: S C explain recursion)
Perplexity Query
SEARCH PERPLEXITY "latest AI news"
Query Perplexity (short: S P latest AI news)
Search and Select Workflow
Find the file first:
FIND EXACT important_doc.pdf
Then select from the found location:
SELECT important_doc.pdf FROM C:\Found\Path\
Common Workflows
Here are some typical workflows that demonstrate dir2's power and efficiency with clean, step-by-step patterns.
Pattern 1: Quick File Execution
SELECT app.exe FROM C:\Tools\
Select Application - Load an executable into state
RUN STATE
Execute Immediately - Run the selected application
Pattern 2: Save to Favorites
SELECT backup.py FROM C:\Scripts\
Select Script - Choose a frequently used script
FAV SET STATE
Add to Favorites - Save for quick access later
FAV VIEW
View Favorites List - See all saved favorites with index numbers
Pattern 3: Find and Execute
FIND EXACT deploy.bat
Find File - Search entire system for the file
SELECT deploy.bat FROM C:\Found\Path\
Select from Found Location - Load the discovered file
RUN STATE
Execute - Run the found and selected file
Pattern 4: Web Research
SEARCH GOOGLE "rust file management"
Google Search - Research topics in your browser
SEARCH CHATGPT "explain SQL syntax"
ChatGPT Query - Ask AI for explanations and help
Development Workflow Example
Navigate and explore:
LD
CD C:\Projects\MyApp\
SELECT build.py FROM .
FAV SET STATE
RUN STATE
Tips & Tricks
Master these tips to become more efficient with dir2.
Navigation and Exploration
- Use
LD
frequently to see files in the current directory - Use
WD <name>
to change to a specific directory - Use
CD
to navigate between directories efficiently - Use
LC
to list all available commands anytime
State Management
- Always check your current state with
VIEW STATE
orVS
- Use
META STATE
to get file information before execution - Clear state with
DROP STATE
when switching tasks - Remember: only one file can be in state at a time
Favorites Efficiency
- Add frequently used scripts to favorites with
FAV SET STATE
- Use
FAV VIEW
to see all your shortcuts - Run favorites by index:
RUN FAV 1
,RUN FAV 2
, etc. - Remove unused favorites with
FAV RM <index>
Search Strategies
- Use
FE
as a shortcut forFIND EXACT
- Combine file search with web research:
FE config.json
thenS G "config.json best practices"
- Use specific search engines: Google for general search, DDG for privacy, ChatGPT for explanations
- Web searches open in your browser while dir2 stays active
Command Shortcuts
/C
instead ofCLS
to clear screen/E
instead ofEXIT
to quitVS
instead ofVIEW STATE
RS
instead ofRUN STATE
S G
instead ofSEARCH GOOGLE
Advanced Usage
Quick project workflow:
CD C:\Projects\NewProject\
LD
SELECT setup.py FROM .
FAV SET STATE
Development cycle:
RUN FAV 1
SELECT build.py FROM .
RUN STATE
SEARCH GOOGLE "deployment best practices"
Error Prevention
- Use
LD
to verify file existence before selection - Check state with
VS
before running commands - Use full paths for files outside current directory
- Test file execution outside dir2 if problems occur