File Management
Perform safe file and directory operations on Unix systems using built-in tools for listing, searching, reading, organizing, and managing without external bi...
TyroneMok
@tyronecoh
What This Skill Does
Performs safe file and directory operations on Unix and macOS systems using only pre-installed command-line tools. Covers listing, searching, reading, organizing, moving, copying, deleting, and archiving files with built-in safety checks that confirm destructive actions before execution.
Replaces installing third-party file management tools or writing custom scripts by providing a comprehensive set of safe, dependency-free Unix commands for all common filesystem tasks.
When to Use It
- List directory contents with human-readable sizes and hidden files
- Search for files by name pattern, modification date, or size
- Find text inside files using grep with context lines
- Analyze disk usage to identify largest directories or files
- Batch rename files by changing extensions or replacing spaces
- Archive and compress directories into tar.gz or zip format
Install
$ openclaw skills install @tyronecoh/file-managementFile Management
Safe filesystem operations using only pre-installed system tools. No external dependencies, no network access, no install.
Core Principle
Safety first — always confirm destructive operations before executing.
mv,cp,rmare irreversible without a backup- Prefer
ls -labefore touching anything - For deletions, prefer
trash(macOS) orrmas last resort
Built-in Tools Only
Guaranteed on all Unix/macOS
| Tool | Purpose | Notes |
|---|---|---|
ls | List files | All Unix ✅ |
find | Search files | All Unix ✅ |
grep | Search file contents | All Unix ✅ |
cat / head / tail | Read files | All Unix ✅ |
mv | Move / rename | Write ⚠️ |
cp | Copy files | Write ⚠️ |
mkdir | Create directories | Write ⚠️ |
rm | Delete files | Write ⚠️ last resort |
stat | File metadata | All Unix ✅ |
du | Disk usage | All Unix ✅ |
tar | Archive files | All Unix ✅ |
xattr | Extended attributes | macOS ✅ |
macOS-specific (pre-installed)
| Tool | Purpose | Notes |
|---|---|---|
trash | Move to Trash (recoverable) | macOS ✅ preferred |
pbcopy / pbpaste | Clipboard | macOS ✅ |
mdls | Spotlight metadata | macOS ✅ |
mdutil | Spotlight index | macOS ✅ |
Optional tools (may not be installed)
These are helpful but NOT guaranteed. Check with which <tool> before using:
tree— directory tree view (install:brew install tree)rg(ripgrep) — faster grep (install:brew install ripgrep)fd— faster find (install:brew install fd)dust— better du (install:brew install dust)bat— better cat (install:brew install bat)
Common Patterns
List Directory Contents
# Basic listing
ls -la /path/to/dir
# Human-readable sizes, newest first
ls -lahF /path/to/dir | sort -k5 -rh
# Recursive depth
find /path -maxdepth 2 -type f
# Show hidden files
ls -la /path/to/dir
Search for Files by Name
# Find by name pattern
find /path -name "*.txt" -type f
# Case-insensitive
find /path -iname "readme*"
# Modified in last N days
find /path -name "*.md" -mtime -7
# By size
find /path -size +100M
Search File Contents
# Grep with context
grep -rn "search_term" /path
# Case-insensitive
grep -ri "search_term" /path
# Only filenames with matches
grep -rl "search_term" /path
Disk Usage Analysis
# Total size of directory
du -sh /path/to/dir
# Per-subdirectory breakdown
du -h --max-depth=1 /path | sort -rh
# Find largest files (recursive)
find /path -type f -exec du -h {} + | sort -rh | head -20
Move / Copy / Delete
# Move (rename)
mv source.txt /new/path/
# Copy (recursive for directories)
cp -r /source/dir /dest/dir
# Delete — ALWAYS confirm first
# Preferred on macOS (goes to Trash):
trash /path/to/file.txt
# Or rm as last resort:
rm /path/to/file.txt
Batch Rename (pure bash)
# Rename all .txt to .md in current directory
for f in *.txt; do mv "$f" "${f%.txt}.md"; done
# Replace spaces with underscores
for f in *\ *; do mv "$f" "${f// /_}"; done
Archive & Compress
# Create tar.gz
tar -czvf archive.tar.gz /path
# Extract
tar -xzvf archive.tar.gz
# Create zip
zip -r archive.zip /path
# Extract zip
unzip archive.zip
Permission Model
Read-only operations — safe to execute without asking:
ls, find, grep, cat, head, tail, du, stat, file, mdls
Write operations — always confirm before executing:
mv, cp, mkdir, trash, rm, zip, tar
For destructive operations:
- Show what will be affected first
- Ask for confirmation with exact command
- Prefer
trashoverrmon macOS
Anti-Patterns (Never Do)
- ❌
rm -rf /or any recursive delete without confirming - ❌
chmod -R 777or permission changes that break security - ❌ Executing downloaded scripts directly without review
- ❌ Accessing paths outside user's home without asking
- ❌
sudooperations unless explicitly requested
Quick Reference
# Where am I?
pwd
# What's in current directory?
ls -la
# Find all PDFs larger than 10MB
find ~ -name "*.pdf" -size +10M
# How much space is used?
du -sh ~/Library
# Search for TODO in code files
grep -rn --include="*.py" "TODO" ~/code/
Top skills in this category
Agent Browser
@matrixyHeadless browser automation CLI optimized for AI agents with accessibility tree snapshots and ref-based element selection
Auto-Updater Skill
@maximepradesAutomatically update Clawdbot and all installed skills once daily. Runs via cron, checks for updates, applies them, and messages the user with a summary of what changed.
Free Ride - Unlimited free AI
@shaivpidadiManages free AI models from OpenRouter for OpenClaw. Automatically ranks models by quality, configures fallbacks for rate-limit handling, and updates opencla...
Automation Workflows
@jk-0001Design and implement automation workflows to save time and scale operations as a solopreneur. Use when identifying repetitive tasks to automate, building workflows across tools, setting up triggers and actions, or optimizing existing automations. Covers automation opportunity identification, workflow design, tool selection (Zapier, Make, n8n), testing, and maintenance. Trigger on "automate", "automation", "workflow automation", "save time", "reduce manual work", "automate my business", "no-code automation".
Desktop Control
@matagulAdvanced desktop automation with mouse, keyboard, and screen control